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 (
    293, 13957, 13963, 13998, 14054, 1862, 
    23101, 23804, 32411, 33578, 33884, 
    33906, 35738, 36181, 3624, 5457, 6373, 
    6635, 6641, 13053, 6657, 6663, 6664, 
    839, 968, 851, 867, 3813, 868, 937, 981, 
    870, 1111, 2614, 41282, 5780, 6799, 
    7123, 7130, 909, 911, 16633, 23795, 
    2463, 2538, 2557, 6631, 6632, 6839, 
    7225, 2474, 2554, 2890, 2960, 33856, 
    33865, 33868, 33903, 36185, 5152, 5393, 
    5521, 6578, 6638, 912, 918, 927, 931, 
    951, 964, 971, 992, 995
  ) 
  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.03926

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "71.20"
    },
    "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": 73,
          "rows_produced_per_join": 1,
          "filtered": "2.00",
          "cost_info": {
            "read_cost": "62.10",
            "eval_cost": "0.15",
            "prefix_cost": "62.25",
            "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 (293,13957,13963,13998,14054,1862,23101,23804,32411,33578,33884,33906,35738,36181,3624,5457,6373,6635,6641,13053,6657,6663,6664,839,968,851,867,3813,868,937,981,870,1111,2614,41282,5780,6799,7123,7130,909,911,16633,23795,2463,2538,2557,6631,6632,6839,7225,2474,2554,2890,2960,33856,33865,33868,33903,36185,5152,5393,5521,6578,6638,912,918,927,931,951,964,971,992,995)) 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": 28,
          "filtered": "100.00",
          "using_index": true,
          "cost_info": {
            "read_cost": "1.30",
            "eval_cost": "2.84",
            "prefix_cost": "66.40",
            "data_read_per_join": "455"
          },
          "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.14",
            "prefix_cost": "69.24",
            "data_read_per_join": "6K"
          },
          "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.14",
            "prefix_cost": "69.38",
            "data_read_per_join": "45"
          },
          "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.30",
            "eval_cost": "0.04",
            "prefix_cost": "70.83",
            "data_read_per_join": "8"
          },
          "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.33",
            "eval_cost": "0.00",
            "prefix_cost": "71.19",
            "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": "71.20",
            "data_read_per_join": "0"
          },
          "used_columns": [
            "product_id",
            "price",
            "lower_limit",
            "company_id",
            "usergroup_id"
          ]
        }
      }
    ]
  }
}

Result

min max
7.49 568.74