SELECT 
  q_products.*, 
  q_product_descriptions.*, 
  MIN(
    IF(
      q_product_prices.percentage_discount = 0, 
      q_product_prices.price, 
      q_product_prices.price - (
        q_product_prices.price * q_product_prices.percentage_discount
      )/ 100
    )
  ) as price, 
  GROUP_CONCAT(
    CASE WHEN (
      q_products_categories.link_type = 'M'
    ) THEN CONCAT(
      q_products_categories.category_id, 
      'M'
    ) ELSE q_products_categories.category_id END 
    ORDER BY 
      (
        q_products_categories.link_type = 'M'
      ) DESC, 
      q_products_categories.category_position ASC, 
      q_products_categories.category_id ASC
  ) as category_ids, 
  popularity.total as popularity, 
  companies.company as company_name, 
  q_products.is_returnable, 
  q_products.return_period, 
  q_product_sales.amount as sales_amount, 
  q_seo_names.name as seo_name, 
  q_seo_names.path as seo_path, 
  q_discussion.type as discussion_type 
FROM 
  q_products 
  LEFT JOIN q_product_prices ON q_product_prices.product_id = q_products.product_id 
  AND q_product_prices.lower_limit = 1 
  AND q_product_prices.usergroup_id IN (0, 0, 1) 
  LEFT JOIN q_product_descriptions ON q_product_descriptions.product_id = q_products.product_id 
  AND q_product_descriptions.lang_code = 'en' 
  LEFT JOIN q_companies as companies ON companies.company_id = q_products.company_id 
  INNER JOIN q_products_categories ON q_products_categories.product_id = q_products.product_id 
  INNER JOIN q_categories ON q_categories.category_id = q_products_categories.category_id 
  AND (
    q_categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, q_categories.usergroup_ids) 
    OR FIND_IN_SET(1, q_categories.usergroup_ids)
  ) 
  AND (
    q_products.usergroup_ids = '' 
    OR FIND_IN_SET(0, q_products.usergroup_ids) 
    OR FIND_IN_SET(1, q_products.usergroup_ids)
  ) 
  AND q_categories.status IN ('A', 'H') 
  AND q_products.status IN ('A', 'H') 
  LEFT JOIN q_product_popularity as popularity ON popularity.product_id = q_products.product_id 
  LEFT JOIN q_product_sales ON q_product_sales.product_id = q_products.product_id 
  AND q_product_sales.category_id = 92 
  LEFT JOIN q_seo_names ON q_seo_names.object_id = 40987 
  AND q_seo_names.type = 'p' 
  AND q_seo_names.dispatch = '' 
  AND q_seo_names.lang_code = 'en' 
  LEFT JOIN q_discussion ON q_discussion.object_id = q_products.product_id 
  AND q_discussion.object_type = 'P' 
WHERE 
  q_products.product_id = 40987 
  AND (
    companies.status = 'A' 
    OR q_products.company_id = 0
  ) 
GROUP BY 
  q_products.product_id

Query time 0.00134

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3.84"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "q_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.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "5K"
            },
            "used_columns": [
              "product_id",
              "product_code",
              "product_type",
              "status",
              "company_id",
              "list_price",
              "vendor_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",
              "__variation_code",
              "__variation_options",
              "__is_default_variation",
              "buy_now_url"
            ]
          }
        },
        {
          "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.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "32"
            },
            "used_columns": [
              "product_id",
              "total"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_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.20",
              "prefix_cost": "0.00",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "category_id",
              "product_id",
              "amount"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_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": "1.00",
              "eval_cost": "0.20",
              "prefix_cost": "1.20",
              "data_read_per_join": "24"
            },
            "used_columns": [
              "product_id",
              "price",
              "percentage_discount",
              "lower_limit",
              "usergroup_id"
            ],
            "attached_condition": "<if>(is_not_null_compl(q_product_prices), ((`portal`.`q_product_prices`.`lower_limit` = 1) and (`portal`.`q_product_prices`.`usergroup_id` in (0,0,1))), true)"
          }
        },
        {
          "table": {
            "table_name": "q_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.20",
              "prefix_cost": "1.40",
              "data_read_per_join": "3K"
            },
            "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"
            ]
          }
        },
        {
          "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.20",
              "prefix_cost": "1.60",
              "data_read_per_join": "5K"
            },
            "used_columns": [
              "company_id",
              "status",
              "company"
            ],
            "attached_condition": "<if>(found_match(companies), ((`portal`.`companies`.`status` = 'A') or 0), true)"
          }
        },
        {
          "table": {
            "table_name": "q_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": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.20",
              "prefix_cost": "2.80",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type",
              "category_position"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "portal.q_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "20.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.04",
              "prefix_cost": "3.00",
              "data_read_per_join": "540"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "(((`portal`.`q_categories`.`usergroup_ids` = '') or find_in_set(0,`portal`.`q_categories`.`usergroup_ids`) or find_in_set(1,`portal`.`q_categories`.`usergroup_ids`)) and (`portal`.`q_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "q_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": 3,
            "rows_produced_per_join": 0,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.60",
              "eval_cost": "0.12",
              "prefix_cost": "3.72",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "name",
              "object_id",
              "type",
              "dispatch",
              "path",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_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.12",
              "prefix_cost": "3.84",
              "data_read_per_join": "9"
            },
            "used_columns": [
              "object_id",
              "object_type",
              "type"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id product_code product_type status company_id list_price vendor_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 __variation_code __variation_options __is_default_variation buy_now_url lang_code product shortname short_description full_description meta_keywords meta_description search_words page_title age_warning_message promo_text price category_ids popularity company_name sales_amount seo_name seo_path discussion_type
40987 DK3030-C1 P A 61 159.00 75.65 1 0.000 0 0 0 0.00 0 1568641590 1693907908 0 N N N B N R N N N Y 10 0 S 1 0 1 0 N 0 P F 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 N en Daniel Klein Polarized Wayfarer Men's Sunglasses - DK3030-C1|50 Black Color Lens <ul class="a-unordered-list a-vertical a-spacing-none"><li><span class="a-list-item">Size Map: Medium</span></li><li><span class="a-list-item">Frame size: Lens width - 50 mm, nose-bridge: 18 mm, temple length: 140 mm</span></li><li><span class="a-list-item">1 year on manufacturing defects</span></li><li><span class="a-list-item">100% UV protected</span></li><li><span class="a-list-item">Grey colored frame with Black temple</span></li><li><span class="a-list-item">Plastic frame</span></li><li><span class="a-list-item">Black colored Composite lens</span></li><li><span class="a-list-item">Ideal for: Men</span></li></ul> 89.000000 92M 7377 Jubilee Store LLC daniel-kleinpolarized-wayfarer-sunglasses-dk1087c16 12/604/91/92