SELECT 
  SQL_CALC_FOUND_ROWS (
    CASE WHEN products.parent_product_id <> 0 THEN products.parent_product_id ELSE products.product_id END
  ) AS product_id, 
  descr1.product as product, 
  companies.company as company_name, 
  GROUP_CONCAT(
    products.product_id 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS product_ids, 
  GROUP_CONCAT(
    products.product_type 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS product_types, 
  GROUP_CONCAT(
    products.parent_product_id 
    ORDER BY 
      products.parent_product_id ASC, 
      products.product_id ASC
  ) AS parent_product_ids, 
  products.product_type, 
  products.parent_product_id, 
  SUM(ushop_product_sales.amount) as sales_amount 
FROM 
  ushop_products as products 
  LEFT JOIN ushop_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'es' 
  LEFT JOIN ushop_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  LEFT JOIN ushop_companies AS companies ON companies.company_id = products.company_id 
  INNER JOIN ushop_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN ushop_categories ON ushop_categories.category_id = products_categories.category_id 
  AND (
    ushop_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, ushop_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, ushop_categories.usergroup_ids
    )
  ) 
  AND ushop_categories.status IN ('A', 'H') 
  AND ushop_categories.storefront_id IN (0, 1) 
  INNER JOIN ushop_product_sales ON ushop_product_sales.product_id = products.product_id 
  AND ushop_product_sales.category_id = products_categories.category_id 
  LEFT JOIN ushop_cp_auctions as auctions ON products.product_id = auctions.product_id 
  LEFT JOIN ushop_users ON products.company_id = ushop_users.company_id 
  AND ushop_users.user_type = 'V' 
  AND ushop_users.user_id = 0 
WHERE 
  1 
  AND companies.status IN ('A') 
  AND (
    products.usergroup_ids = '' 
    OR FIND_IN_SET(0, products.usergroup_ids) 
    OR FIND_IN_SET(1, products.usergroup_ids)
  ) 
  AND products.status IN ('A') 
  AND prices.usergroup_id IN (0, 0, 1) 
  AND ushop_product_sales.amount >= 1 
  AND (
    CASE WHEN (
      products.cp_active_auction_id > 0
    ) THEN (
      (
        auctions.users = '' 
        OR FIND_IN_SET(0, auctions.users)
      ) 
      AND auctions.show_on_category = 'Y'
    ) ELSE 1 END 
    OR ushop_users.company_id = products.company_id
  ) 
  AND products.product_type <> 'W' 
  AND products.product_type != 'D' 
GROUP BY 
  ushop_product_sales.product_id 
ORDER BY 
  sales_amount desc, 
  products.product_id ASC 
LIMIT 
  0, 3

Query time 0.00231

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "6.75"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": true,
        "buffer_result": {
          "using_temporary_table": true,
          "nested_loop": [
            {
              "table": {
                "table_name": "companies",
                "access_type": "ALL",
                "possible_keys": [
                  "PRIMARY"
                ],
                "rows_examined_per_scan": 7,
                "rows_produced_per_join": 0,
                "filtered": "14.29",
                "cost_info": {
                  "read_cost": "1.17",
                  "eval_cost": "0.10",
                  "prefix_cost": "1.27",
                  "data_read_per_join": "6K"
                },
                "used_columns": [
                  "company_id",
                  "status",
                  "company"
                ],
                "attached_condition": "(`marketplace`.`companies`.`status` = 'A')"
              }
            },
            {
              "table": {
                "table_name": "ushop_product_sales",
                "access_type": "ALL",
                "possible_keys": [
                  "PRIMARY",
                  "pa"
                ],
                "rows_examined_per_scan": 21,
                "rows_produced_per_join": 6,
                "filtered": "33.33",
                "using_join_buffer": "hash join",
                "cost_info": {
                  "read_cost": "1.92",
                  "eval_cost": "0.70",
                  "prefix_cost": "3.88",
                  "data_read_per_join": "111"
                },
                "used_columns": [
                  "category_id",
                  "product_id",
                  "amount"
                ],
                "attached_condition": "(`marketplace`.`ushop_product_sales`.`amount` >= 1)"
              }
            },
            {
              "table": {
                "table_name": "products",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "status"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "product_id"
                ],
                "key_length": "3",
                "ref": [
                  "marketplace.ushop_product_sales.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "7.87",
                "cost_info": {
                  "read_cost": "1.75",
                  "eval_cost": "0.06",
                  "prefix_cost": "6.33",
                  "data_read_per_join": "2K"
                },
                "used_columns": [
                  "product_id",
                  "product_type",
                  "status",
                  "company_id",
                  "usergroup_ids",
                  "parent_product_id",
                  "cp_active_auction_id"
                ],
                "attached_condition": "((`marketplace`.`products`.`company_id` = `marketplace`.`companies`.`company_id`) and ((`marketplace`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`marketplace`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`marketplace`.`products`.`usergroup_ids`))) and (`marketplace`.`products`.`status` = 'A') and (`marketplace`.`products`.`product_type` <> 'W') and (`marketplace`.`products`.`product_type` <> 'D'))"
              }
            },
            {
              "table": {
                "table_name": "auctions",
                "access_type": "ref",
                "possible_keys": [
                  "product_id"
                ],
                "key": "product_id",
                "used_key_parts": [
                  "product_id"
                ],
                "key_length": "4",
                "ref": [
                  "marketplace.ushop_product_sales.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "100.00",
                "index_condition": "<if>(is_not_null_compl(auctions), (`marketplace`.`ushop_product_sales`.`product_id` = `marketplace`.`auctions`.`product_id`), true)",
                "cost_info": {
                  "read_cost": "0.14",
                  "eval_cost": "0.06",
                  "prefix_cost": "6.53",
                  "data_read_per_join": "114"
                },
                "used_columns": [
                  "product_id",
                  "users",
                  "show_on_category"
                ]
              }
            },
            {
              "table": {
                "table_name": "ushop_categories",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "c_status",
                  "p_category_id"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "category_id"
                ],
                "key_length": "3",
                "ref": [
                  "marketplace.ushop_product_sales.category_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "5.00",
                "cost_info": {
                  "read_cost": "0.14",
                  "eval_cost": "0.00",
                  "prefix_cost": "6.72",
                  "data_read_per_join": "91"
                },
                "used_columns": [
                  "category_id",
                  "storefront_id",
                  "usergroup_ids",
                  "status"
                ],
                "attached_condition": "(((`marketplace`.`ushop_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`marketplace`.`ushop_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`marketplace`.`ushop_categories`.`usergroup_ids`))) and (`marketplace`.`ushop_categories`.`status` in ('A','H')) and (`marketplace`.`ushop_categories`.`storefront_id` in (0,1)))"
              }
            },
            {
              "table": {
                "table_name": "ushop_users",
                "access_type": "const",
                "possible_keys": [
                  "PRIMARY"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "user_id"
                ],
                "key_length": "3",
                "ref": [
                  "const"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "0.00",
                  "eval_cost": "0.00",
                  "prefix_cost": "6.72",
                  "data_read_per_join": "181"
                },
                "used_columns": [
                  "user_id",
                  "user_type",
                  "company_id"
                ],
                "attached_condition": "(<if>(found_match(ushop_users), ((0 <> (case when (`marketplace`.`products`.`cp_active_auction_id` > 0) then (((`marketplace`.`auctions`.`users` = '') or (0 <> find_in_set(0,`marketplace`.`auctions`.`users`))) and (`marketplace`.`auctions`.`show_on_category` = 'Y')) else 1 end)) or (`marketplace`.`ushop_users`.`company_id` = `marketplace`.`companies`.`company_id`)), true) and <if>(is_not_null_compl(ushop_users), ((`marketplace`.`ushop_users`.`company_id` = `marketplace`.`companies`.`company_id`) and (`marketplace`.`ushop_users`.`user_type` = 'V')), true))"
              }
            },
            {
              "table": {
                "table_name": "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": [
                  "marketplace.ushop_product_sales.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "98.81",
                "cost_info": {
                  "read_cost": "0.01",
                  "eval_cost": "0.00",
                  "prefix_cost": "6.73",
                  "data_read_per_join": "0"
                },
                "used_columns": [
                  "product_id",
                  "lower_limit",
                  "usergroup_id"
                ],
                "attached_condition": "((`marketplace`.`prices`.`lower_limit` = 1) and (`marketplace`.`prices`.`usergroup_id` in (0,0,1)))"
              }
            },
            {
              "table": {
                "table_name": "products_categories",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "pt"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "category_id",
                  "product_id"
                ],
                "key_length": "6",
                "ref": [
                  "marketplace.ushop_product_sales.category_id",
                  "marketplace.ushop_product_sales.product_id"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "100.00",
                "using_index": true,
                "cost_info": {
                  "read_cost": "0.01",
                  "eval_cost": "0.00",
                  "prefix_cost": "6.74",
                  "data_read_per_join": "0"
                },
                "used_columns": [
                  "product_id",
                  "category_id"
                ]
              }
            },
            {
              "table": {
                "table_name": "descr1",
                "access_type": "eq_ref",
                "possible_keys": [
                  "PRIMARY",
                  "product_id"
                ],
                "key": "PRIMARY",
                "used_key_parts": [
                  "product_id",
                  "lang_code"
                ],
                "key_length": "9",
                "ref": [
                  "marketplace.ushop_product_sales.product_id",
                  "const"
                ],
                "rows_examined_per_scan": 1,
                "rows_produced_per_join": 0,
                "filtered": "100.00",
                "cost_info": {
                  "read_cost": "0.01",
                  "eval_cost": "0.00",
                  "prefix_cost": "6.75",
                  "data_read_per_join": "127"
                },
                "used_columns": [
                  "product_id",
                  "lang_code",
                  "product"
                ]
              }
            }
          ]
        }
      }
    }
  }
}

Result

product_id product company_name product_ids product_types parent_product_ids product_type parent_product_id sales_amount
536 Test product ACME Corp 536 P 0 P 0 20
346 XRS 9770 Ferrequipo 346 P 0 P 0 10
477 Guitar Man Album Artwork Ferrequipo 477 P 0 P 0 7