SELECT 
  MIN(
    IF(
      shared_prices.product_id IS NOT NULL, 
      shared_prices.price, cscart_product_prices.price
    )
  ) as min, 
  MAX(
    IF(
      shared_prices.product_id IS NOT NULL, 
      shared_prices.price, cscart_product_prices.price
    )
  ) as max 
FROM 
  cscart_product_prices 
  LEFT JOIN cscart_products as products ON products.product_id = cscart_product_prices.product_id 
  LEFT JOIN cscart_product_prices as prices_2 ON cscart_product_prices.product_id = prices_2.product_id 
  AND cscart_product_prices.price > prices_2.price 
  AND prices_2.lower_limit = 1 
  AND prices_2.usergroup_id IN (0, 0, 1) 
  LEFT JOIN cscart_ult_product_prices AS shared_prices ON shared_prices.product_id = products.product_id 
  AND shared_prices.lower_limit = 1 
  AND shared_prices.usergroup_id IN (0, 0, 1) 
  AND shared_prices.company_id = 1 
  LEFT JOIN cscart_product_options_inventory as inventory ON inventory.product_id = products.product_id 
  INNER JOIN cscart_products_categories as products_categories ON products_categories.product_id = products.product_id 
  INNER JOIN cscart_categories ON cscart_categories.category_id = products_categories.category_id 
  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_categories.status IN ('A', 'H') 
  LEFT JOIN cscart_product_popularity as popularity ON popularity.product_id = products.product_id 
WHERE 
  products.status IN ('A') 
  AND cscart_categories.category_id IN (
    284, 1289, 1582, 2461, 2523, 2524, 2530, 
    2629, 29509, 41473, 36858, 7027, 2475, 
    2566, 2571, 2579, 2580, 2610, 2630, 
    2634, 3538, 5536, 28406, 36839, 28522, 
    36794, 36824, 36825, 36796, 36797, 
    36798, 36799, 36800, 36805, 36862, 
    36864, 36808, 36809, 36842, 36827, 
    36865, 36815, 36816, 36823, 36851, 
    36817, 36820, 41311, 36845, 36846, 
    36847, 36854, 36849, 36850, 41453, 
    36855, 36856, 36857, 36863, 36859, 
    5452, 36789, 36790, 36791, 36792, 36795, 
    5690, 7103
  ) 
  AND cscart_categories.company_id = 1 
  AND (
    CASE products.tracking WHEN 'O' THEN inventory.amount > 0 WHEN 'B' THEN products.amount > 0 ELSE 1 END
  ) 
  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 cscart_product_prices.lower_limit = 1 
  AND cscart_product_prices.usergroup_id IN (0, 0, 1) 
  AND prices_2.price IS NULL

Query time 0.01858

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "76.40"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "inventory",
          "access_type": "system",
          "possible_keys": [
            "pc"
          ],
          "rows_examined_per_scan": 0,
          "rows_produced_per_join": 1,
          "filtered": "0.00",
          "const_row_not_found": true,
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "880"
          },
          "used_columns": [
            "product_id",
            "amount"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_categories",
          "access_type": "range",
          "possible_keys": [
            "PRIMARY",
            "c_status",
            "p_category_id"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "category_id"
          ],
          "key_length": "3",
          "rows_examined_per_scan": 68,
          "rows_produced_per_join": 1,
          "filtered": "2.00",
          "cost_info": {
            "read_cost": "68.09",
            "eval_cost": "0.14",
            "prefix_cost": "68.23",
            "data_read_per_join": "3K"
          },
          "used_columns": [
            "category_id",
            "company_id",
            "usergroup_ids",
            "status"
          ],
          "attached_condition": "((`maniamall_cscart`.`cscart_categories`.`company_id` = 1) and (`maniamall_cscart`.`cscart_categories`.`category_id` in (284,1289,1582,2461,2523,2524,2530,2629,29509,41473,36858,7027,2475,2566,2571,2579,2580,2610,2630,2634,3538,5536,28406,36839,28522,36794,36824,36825,36796,36797,36798,36799,36800,36805,36862,36864,36808,36809,36842,36827,36865,36815,36816,36823,36851,36817,36820,41311,36845,36846,36847,36854,36849,36850,41453,36855,36856,36857,36863,36859,5452,36789,36790,36791,36792,36795,5690,7103)) and ((`maniamall_cscart`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`maniamall_cscart`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`maniamall_cscart`.`cscart_categories`.`usergroup_ids`))) and (`maniamall_cscart`.`cscart_categories`.`status` in ('A','H')))"
        }
      },
      {
        "table": {
          "table_name": "products_categories",
          "access_type": "ref",
          "possible_keys": [
            "PRIMARY",
            "pt"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "category_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.cscart_categories.category_id"
          ],
          "rows_examined_per_scan": 19,
          "rows_produced_per_join": 26,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "1.26",
            "eval_cost": "2.65",
            "prefix_cost": "72.14",
            "data_read_per_join": "423"
          },
          "used_columns": [
            "product_id",
            "category_id"
          ]
        }
      },
      {
        "table": {
          "table_name": "products",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY",
            "status"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.products_categories.product_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "5.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.13",
            "prefix_cost": "74.79",
            "data_read_per_join": "5K"
          },
          "used_columns": [
            "product_id",
            "status",
            "amount",
            "usergroup_ids",
            "tracking"
          ],
          "attached_condition": "((`maniamall_cscart`.`products`.`status` = 'A') and (0 <> (case `maniamall_cscart`.`products`.`tracking` when 'O' then <cache>((NULL > 0)) when 'B' then (`maniamall_cscart`.`products`.`amount` > 0) else 1 end)) and ((`maniamall_cscart`.`products`.`usergroup_ids` = '') or (0 <> find_in_set(0,`maniamall_cscart`.`products`.`usergroup_ids`)) or (0 <> find_in_set(1,`maniamall_cscart`.`products`.`usergroup_ids`))))"
        }
      },
      {
        "table": {
          "table_name": "popularity",
          "access_type": "eq_ref",
          "possible_keys": [
            "PRIMARY",
            "total"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.products_categories.product_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.13",
            "prefix_cost": "74.92",
            "data_read_per_join": "42"
          },
          "used_columns": [
            "product_id"
          ]
        }
      },
      {
        "table": {
          "table_name": "cscart_product_prices",
          "access_type": "ref",
          "possible_keys": [
            "usergroup",
            "product_id",
            "lower_limit",
            "usergroup_id"
          ],
          "key": "usergroup",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.products_categories.product_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 0,
          "filtered": "25.00",
          "cost_info": {
            "read_cost": "1.05",
            "eval_cost": "0.03",
            "prefix_cost": "76.10",
            "data_read_per_join": "7"
          },
          "used_columns": [
            "product_id",
            "price",
            "lower_limit",
            "usergroup_id"
          ],
          "attached_condition": "((`maniamall_cscart`.`cscart_product_prices`.`lower_limit` = 1) and (`maniamall_cscart`.`cscart_product_prices`.`usergroup_id` in (0,0,1)))"
        }
      },
      {
        "table": {
          "table_name": "prices_2",
          "access_type": "ref",
          "possible_keys": [
            "usergroup",
            "product_id",
            "lower_limit",
            "usergroup_id"
          ],
          "key": "usergroup",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.products_categories.product_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 0,
          "filtered": "5.00",
          "not_exists": true,
          "cost_info": {
            "read_cost": "0.26",
            "eval_cost": "0.00",
            "prefix_cost": "76.40",
            "data_read_per_join": "0"
          },
          "used_columns": [
            "product_id",
            "price",
            "lower_limit",
            "usergroup_id"
          ],
          "attached_condition": "(<if>(found_match(prices_2), (`maniamall_cscart`.`prices_2`.`price` is null), true) and <if>(is_not_null_compl(prices_2), ((`maniamall_cscart`.`prices_2`.`lower_limit` = 1) and (`maniamall_cscart`.`cscart_product_prices`.`price` > `maniamall_cscart`.`prices_2`.`price`) and (`maniamall_cscart`.`prices_2`.`usergroup_id` in (0,0,1))), true))"
        }
      },
      {
        "table": {
          "table_name": "shared_prices",
          "access_type": "ref",
          "possible_keys": [
            "usergroup",
            "product_id",
            "company_id",
            "lower_limit",
            "usergroup_id"
          ],
          "key": "usergroup",
          "used_key_parts": [
            "product_id"
          ],
          "key_length": "3",
          "ref": [
            "maniamall_cscart.products_categories.product_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 0,
          "filtered": "100.00",
          "index_condition": "<if>(is_not_null_compl(shared_prices), ((`maniamall_cscart`.`shared_prices`.`company_id` = 1) and (`maniamall_cscart`.`shared_prices`.`lower_limit` = 1) and (`maniamall_cscart`.`shared_prices`.`usergroup_id` in (0,0,1))), true)",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.00",
            "prefix_cost": "76.40",
            "data_read_per_join": "0"
          },
          "used_columns": [
            "product_id",
            "price",
            "lower_limit",
            "company_id",
            "usergroup_id"
          ]
        }
      }
    ]
  }
}

Result

min max
8.74 182.49