SELECT 
  cscart_products.*, 
  cscart_product_descriptions.*, 
  MIN(
    IF(
      cscart_product_prices.percentage_discount = 0, 
      cscart_product_prices.price, 
      cscart_product_prices.price - (
        cscart_product_prices.price * cscart_product_prices.percentage_discount
      )/ 100
    )
  ) as price, 
  GROUP_CONCAT(
    CASE WHEN (
      cscart_products_categories.link_type = 'M'
    ) THEN CONCAT(
      cscart_products_categories.category_id, 
      'M'
    ) ELSE cscart_products_categories.category_id END 
    ORDER BY 
      cscart_categories.storefront_id IN (0, 1) DESC, 
      (
        cscart_products_categories.link_type = 'M'
      ) DESC, 
      cscart_products_categories.category_position ASC, 
      cscart_products_categories.category_id ASC
  ) as category_ids, 
  popularity.total as popularity, 
  companies.company as company_name, 
  cscart_product_sales.amount as sales_amount, 
  cscart_seo_names.name as seo_name, 
  cscart_seo_names.path as seo_path, 
  cscart_discussion.type as discussion_type, 
  cscart_product_review_prepared_data.average_rating average_rating, 
  cscart_product_review_prepared_data.reviews_count product_reviews_count 
FROM 
  cscart_products 
  LEFT JOIN cscart_product_prices ON cscart_product_prices.product_id = cscart_products.product_id 
  AND cscart_product_prices.lower_limit = 1 
  AND cscart_product_prices.usergroup_id IN (0, 0, 1) 
  LEFT JOIN cscart_product_descriptions ON cscart_product_descriptions.product_id = cscart_products.product_id 
  AND cscart_product_descriptions.lang_code = 'pl' 
  LEFT JOIN cscart_companies as companies ON companies.company_id = cscart_products.company_id 
  INNER JOIN cscart_products_categories ON cscart_products_categories.product_id = cscart_products.product_id 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND (
    cscart_products.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_products.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_products.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  AND cscart_products.status IN ('A', 'H') 
  LEFT JOIN cscart_product_popularity as popularity ON popularity.product_id = cscart_products.product_id 
  LEFT JOIN cscart_product_sales ON cscart_product_sales.product_id = cscart_products.product_id 
  AND cscart_product_sales.category_id = 316 
  LEFT JOIN cscart_seo_names ON cscart_seo_names.object_id = 500 
  AND cscart_seo_names.type = 'p' 
  AND cscart_seo_names.dispatch = '' 
  AND cscart_seo_names.lang_code = 'pl' 
  LEFT JOIN cscart_discussion ON cscart_discussion.object_id = cscart_products.product_id 
  AND cscart_discussion.object_type = 'P' 
  LEFT JOIN cscart_product_review_prepared_data ON cscart_product_review_prepared_data.product_id = cscart_products.product_id 
  AND cscart_product_review_prepared_data.storefront_id = 0 
WHERE 
  cscart_products.product_id = 500 
  AND (
    companies.status IN ('A') 
    OR cscart_products.company_id = 0
  ) 
GROUP BY 
  cscart_products.product_id

Query time 0.00081

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.94"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY",
              "status"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.00",
              "data_read_per_join": "4K"
            },
            "used_columns": [
              "product_id",
              "product_code",
              "product_type",
              "status",
              "company_id",
              "list_price",
              "amount",
              "weight",
              "length",
              "width",
              "height",
              "shipping_freight",
              "low_avail_limit",
              "timestamp",
              "updated_timestamp",
              "usergroup_ids",
              "is_edp",
              "edp_shipping",
              "unlimited_download",
              "tracking",
              "free_shipping",
              "zero_price_action",
              "is_pbp",
              "is_op",
              "is_oper",
              "is_returnable",
              "return_period",
              "avail_since",
              "out_of_stock_actions",
              "localization",
              "min_qty",
              "max_qty",
              "qty_step",
              "list_qty_count",
              "tax_ids",
              "age_verification",
              "age_limit",
              "options_type",
              "exceptions_type",
              "details_layout",
              "shipping_params",
              "facebook_obj_type",
              "parent_product_id",
              "buy_now_url",
              "units_in_product",
              "show_price_per_x_units",
              "ab__stickers_manual_ids",
              "ab__stickers_generated_ids",
              "ss_omnibus_display",
              "rp_enable",
              "rp_pre_auth",
              "rp_pay_type",
              "rp_period",
              "rp_free_period",
              "rp_shipping_cost",
              "rp_addon_id",
              "rp_struct_billing",
              "ss_deepl_auto_translate",
              "ss_deepl_changed_fields"
            ]
          }
        },
        {
          "table": {
            "table_name": "popularity",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY",
              "total"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.00",
              "data_read_per_join": "32"
            },
            "used_columns": [
              "product_id",
              "total"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_product_sales",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY",
              "pa"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 0,
            "rows_produced_per_join": 1,
            "filtered": "0.00",
            "unique_row_not_found": true,
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.00",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "category_id",
              "product_id",
              "amount"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_product_prices",
            "access_type": "ref",
            "possible_keys": [
              "usergroup",
              "product_id",
              "lower_limit",
              "usergroup_id"
            ],
            "key": "product_id",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "0.10",
              "prefix_cost": "0.35",
              "data_read_per_join": "24"
            },
            "used_columns": [
              "product_id",
              "price",
              "percentage_discount",
              "lower_limit",
              "usergroup_id"
            ],
            "attached_condition": "<if>(is_not_null_compl(cscart_product_prices), ((`cscartdevel`.`cscart_product_prices`.`lower_limit` = 1) and (`cscartdevel`.`cscart_product_prices`.`usergroup_id` in (0,0,1))), true)"
          }
        },
        {
          "table": {
            "table_name": "cscart_product_descriptions",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY",
              "product_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "product_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.45",
              "data_read_per_join": "5K"
            },
            "used_columns": [
              "product_id",
              "lang_code",
              "product",
              "shortname",
              "short_description",
              "full_description",
              "meta_keywords",
              "meta_description",
              "search_words",
              "page_title",
              "age_warning_message",
              "promo_text",
              "unit_name",
              "ss_baselinker_name",
              "ss_baselinker_description",
              "stop_words"
            ]
          }
        },
        {
          "table": {
            "table_name": "companies",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "company_id"
            ],
            "key_length": "4",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.55",
              "data_read_per_join": "7K"
            },
            "used_columns": [
              "company_id",
              "status",
              "company"
            ],
            "attached_condition": "<if>(found_match(companies), ((`cscartdevel`.`companies`.`status` = 'A') or false), true)"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 5,
            "rows_produced_per_join": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.25",
              "eval_cost": "0.50",
              "prefix_cost": "2.30",
              "data_read_per_join": "80"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type",
              "category_position"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "cscartdevel.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.03",
              "prefix_cost": "2.80",
              "data_read_per_join": "882"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`cscartdevel`.`cscart_categories`.`storefront_id` in (0,1)) and ((`cscartdevel`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`cscartdevel`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`cscartdevel`.`cscart_categories`.`usergroup_ids`))) and (`cscartdevel`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_seo_names",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "dispatch"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "object_id",
              "type",
              "dispatch",
              "lang_code"
            ],
            "key_length": "206",
            "ref": [
              "const",
              "const",
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.06",
              "eval_cost": "0.03",
              "prefix_cost": "2.89",
              "data_read_per_join": "434"
            },
            "used_columns": [
              "name",
              "object_id",
              "type",
              "dispatch",
              "path",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_discussion",
            "access_type": "const",
            "possible_keys": [
              "object_id"
            ],
            "key": "object_id",
            "used_key_parts": [
              "object_id",
              "object_type"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.03",
              "prefix_cost": "2.91",
              "data_read_per_join": "6"
            },
            "used_columns": [
              "object_id",
              "object_type",
              "type"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_product_review_prepared_data",
            "access_type": "const",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "product_id",
              "storefront_id"
            ],
            "key_length": "7",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.03",
              "prefix_cost": "2.94",
              "data_read_per_join": "4"
            },
            "used_columns": [
              "product_id",
              "storefront_id",
              "average_rating",
              "reviews_count"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id product_code product_type status company_id list_price amount weight length width height shipping_freight low_avail_limit timestamp updated_timestamp usergroup_ids is_edp edp_shipping unlimited_download tracking free_shipping zero_price_action is_pbp is_op is_oper is_returnable return_period avail_since out_of_stock_actions localization min_qty max_qty qty_step list_qty_count tax_ids age_verification age_limit options_type exceptions_type details_layout shipping_params facebook_obj_type parent_product_id buy_now_url units_in_product show_price_per_x_units ab__stickers_manual_ids ab__stickers_generated_ids ss_omnibus_display rp_enable rp_pre_auth rp_pay_type rp_period rp_free_period rp_shipping_cost rp_addon_id rp_struct_billing ss_deepl_auto_translate ss_deepl_changed_fields lang_code product shortname short_description full_description meta_keywords meta_description search_words page_title age_warning_message promo_text unit_name ss_baselinker_name ss_baselinker_description stop_words price category_ids popularity company_name sales_amount seo_name seo_path discussion_type average_rating product_reviews_count
500 P A 64 120.00 100 0.000 0 0 0 0.00 0 1750107162 1750258953 0 Y N N N N N N Y 10 0 N N 0 default a:5:{s:16:"min_items_in_box";i:0;s:16:"max_items_in_box";i:0;s:10:"box_length";i:0;s:9:"box_width";i:0;s:10:"box_height";i:0;} 0 0.000 0.000 Y N N B 0 0.00 N pl Webinar: "Ziołowa apteczka dla psa i kota" <p>Podczas tego spotkania dowiesz się, w jakie ziołowe remedia warto się zaopatrzyć i trzymać w swojej domowej apteczce na wypadek nagłych zdarzeń takich jak: rany, zadrapania, krwawienia, ugryzienie kleszcza, zatrucie, biegunka, wymioty, szok/silny stres po wypadku lub pogryzieniu przez innego psa. Dowiesz się, jak wesprzeć swoje zwierzę przy użyciu naturalnych sposobów. Dodatkowo otrzymasz przejrzyste notatki w formie PDF. <br />Całość webinaru trwa 2h, a dostęp otrzymujesz na okres 6 miesięcy. <br /><br /><strong>O prowadzącej:<br /></strong>Zuzanna Rybarczyk - Integralna behawiorystka psów, holistyczna terapeutka zwierząt towarzyszących, zielarka-fitoterapeutka. Założycielka projektu Psiaki w Zen – Tu i Teraz, promującego całościowe podejście do terapii i życia z psem oraz kotem. W swojej pracy sięga po rozmaite narzędzia z zakresu terapii naturalnych, takich jak Tradycyjna Medycyna Chińska, Tellington TTouch, akupresury, fitoterapia/ziołolecznictwo, esencje kwiatowe i aromaterapia. W swojej pracy zwraca ogromną wagę na wpływ emocji opiekuna na zachowanie oraz zdrowie zwierzęcia i ich niezaprzeczalne połączenie. Certyfikowany praktyk metod Tellington TTouch i PsychAromatica. <br />Wykładowczyni w Polskiej Akademii Zoopsychologii i Animaloterapii. Współzałożycielka ośrodka terapeutycznego i wypoczynkowego dla opiekunów z psami, a także dla ludzi szukających ponownego połączenia z Naturą o nazwie Zakątka Transformacji w Beskidzie Niskim.</p> <p>Więcej na temat jej działalności dowiesz się na stronach:<br /><a href="https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.psiakiwzen.pl%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAYnJpZBEwR29QcklpU01xRU1LRnJrOAEe5REAFlqZZ5mPM2IpEfWoAIF1IqyF2cdOyD3W37JYqTIbevHSo9BmxsN5NQ0_aem_ujyHnIYo6naOKnSwaCREbg&amp;h=AT2tKSrfrh2k4jA1kguIqqUx9lMtr1a1K4mKKPHb1eValvVviQ4T2igK7-mjDcEXL-SIzk2mF7_Cv4H5YYFmVSUuUTUWLkvL62qaxNbOFBWW4bcxNwi_gVRYwpcizSuWkp7UtKHCphyS3wgD2jaN2A&amp;__tn__=q&amp;c%5B0%5D=AT2QzduYResf5esuHeOSNbxRLBtDXBSp_ZI7DdpNwF1-HOmV85CFEvytbakkUngHKho2ysGbmQD6PQeHluGHQHLKJf0Ep1pPSD7Tt6GebuDJ7GSJAMLpdH4EjXgFttUg7kow0_Jeq6RScC1hVGpq9Ve9f0JVPjvhQxtdYA" class="x1i10hfl xjbqb8w x1ejq31n x18oe1m7 x1sy0etr xstzfhl x972fbf x10w94by x1qhh985 x14e42zd x9f619 x1ypdohk xt0psk2 xe8uvvx xdj266r x14z9mp xat24cr x1lziwak xexx8yu xyri2b x18d9i69 x1c1uobl x16tdsg8 x1hl2dhg xggy1nq x1a2a7pz xkrqix3 x1sur9pj x1fey0fg x1s688f" target="_blank" rel="noreferrer noopener">www.psiakiwzen.pl</a><br /><a href="https://l.facebook.com/l.php?u=http%3A%2F%2Fwww.zakatek-transformacji.pl%2F%3Ffbclid%3DIwZXh0bgNhZW0CMTAAYnJpZBEwR29QcklpU01xRU1LRnJrOAEetT_JVcyM-aZTeBkQQJxXZIT0JgtJct-fq_OOj5ZDTFynkd81ibzYkbkFYUU_aem_7SsOtqFXecB7XcaTX5R6eg&amp;h=AT1zB0l5M-g2XjxEpDG7ebjKeFQPlcOLqC-ciN329y-ZIyTRrhfaL8hLAPZFA9ll6jWeve_UMmK8css4i378Mjj2NXs7APzCbl7PkOGoPUyiHs9edcvjM5d0JdnqwWcbqDhnP-0rId0aDF0KlFLLXA&amp;__tn__=q&amp;c%5B0%5D=AT2QzduYResf5esuHeOSNbxRLBtDXBSp_ZI7DdpNwF1-HOmV85CFEvytbakkUngHKho2ysGbmQD6PQeHluGHQHLKJf0Ep1pPSD7Tt6GebuDJ7GSJAMLpdH4EjXgFttUg7kow0_Jeq6RScC1hVGpq9Ve9f0JVPjvhQxtdYA" class="x1i10hfl xjbqb8w x1ejq31n x18oe1m7 x1sy0etr xstzfhl x972fbf x10w94by x1qhh985 x14e42zd x9f619 x1ypdohk xt0psk2 xe8uvvx xdj266r x14z9mp xat24cr x1lziwak xexx8yu xyri2b x18d9i69 x1c1uobl x16tdsg8 x1hl2dhg xggy1nq x1a2a7pz xkrqix3 x1sur9pj x1fey0fg x1s688f" target="_blank" rel="noreferrer noopener">www.zakatek-transformacji.pl</a></p> 120.00000000 316M,314,333 381 Zakątek Transformacji - Gospodarstwo w Harmonii z Naturą webinar-ziolowa-apteczka-dla-psa-i-kota 314/316 D