SELECT 
  SQL_CALC_FOUND_ROWS products.product_id, 
  IF(
    shared_descr.product_id IS NOT NULL, 
    shared_descr.product, descr1.product
  ) as product, 
  stoc_intern, 
  pret_achizitie, 
  pret_revanzator, 
  gestiune 
FROM 
  cscart_products as products 
  LEFT JOIN cscart_product_options_inventory as inventory ON inventory.product_id = products.product_id 
  LEFT JOIN cscart_product_descriptions as descr1 ON descr1.product_id = products.product_id 
  AND descr1.lang_code = 'ro' 
  LEFT JOIN cscart_product_prices as prices ON prices.product_id = products.product_id 
  AND prices.lower_limit = 1 
  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_ult_product_descriptions shared_descr ON shared_descr.product_id = products.product_id 
  AND shared_descr.company_id = 1 
  AND shared_descr.lang_code = 'ro' 
  LEFT JOIN cscart_product_popularity as popularity ON popularity.product_id = products.product_id 
WHERE 
  1 
  AND cscart_categories.category_id IN (
    285, 
    1017, 
    1019, 
    1021, 
    1022, 
    1117, 
    1149, 
    1169, 
    1231, 
    12963, 
    1297, 
    13058, 
    13060, 
    1321, 
    1328, 
    1334, 
    1337, 
    34553, 
    5466, 
    6559, 
    6563, 
    7180, 
    1569, 
    28750, 
    30002, 
    30005, 
    34391, 
    34703, 
    36071, 
    36073, 
    37603, 
    41289, 
    5109, 
    7382, 
    1449, 
    14928, 
    14939, 
    14966, 
    30592, 
    15013, 
    15016, 
    23396, 
    28617, 
    28627, 
    2464, 
    2645, 
    28020, 
    28563, 
    28614, 
    28650, 
    28651, 
    28652, 
    28653, 
    28654, 
    29029, 
    29114, 
    29708, 
    29709, 
    30388, 
    2995, 
    11917, 
    2535, 
    28375, 
    28376, 
    28964, 
    3005, 
    34536, 
    5076, 
    5081, 
    5087, 
    30714, 
    5097, 
    5098, 
    5100, 
    5167, 
    5467, 
    5773, 
    5774, 
    6942, 
    7109, 
    7158, 
    7159, 
    7160, 
    7161, 
    7222, 
    30093, 
    30411, 
    30412, 
    30413, 
    30414, 
    30415, 
    30416, 
    30417, 
    30418, 
    30419, 
    30420, 
    30421, 
    30424, 
    30425, 
    30426, 
    30427, 
    30428, 
    30429, 
    30430, 
    30431, 
    30432, 
    30433, 
    30434, 
    30435, 
    30436, 
    30437, 
    30438, 
    30439, 
    30440, 
    30441, 
    30442, 
    30443, 
    30444, 
    30445, 
    30446, 
    30447, 
    30448, 
    30449, 
    30450, 
    30451, 
    30452, 
    30453, 
    30454, 
    30455, 
    30456, 
    30457, 
    30458, 
    30459, 
    30422, 
    30423, 
    3100, 
    1576, 
    1616, 
    2481, 
    2483, 
    2498, 
    2631, 
    2771, 
    28669, 
    28692, 
    32231, 
    32558, 
    33323, 
    34537, 
    3579, 
    42904, 
    4496, 
    5437, 
    5603, 
    5606, 
    5683, 
    5687, 
    5688, 
    5691, 
    5693, 
    8787, 
    921, 
    3662, 
    1084, 
    1601, 
    2063, 
    2529, 
    28686, 
    32403, 
    32404, 
    32405, 
    32406, 
    5083, 
    5685, 
    5077, 
    2778, 
    28657, 
    28658, 
    28758, 
    28759, 
    5079, 
    5080, 
    5158, 
    5459, 
    6574, 
    6623, 
    5190, 
    5548, 
    5554, 
    6333, 
    14789, 
    15306, 
    15307, 
    15309, 
    15311, 
    28615, 
    6334, 
    6335, 
    6336, 
    6337, 
    6338, 
    6339, 
    6644, 
    6765, 
    6793, 
    7347, 
    6766, 
    29009, 
    6767, 
    6768, 
    6769, 
    6770, 
    6771, 
    6772, 
    6773, 
    7308, 
    7324, 
    7325, 
    8788, 
    7132, 
    7133, 
    7134, 
    41366, 
    7220, 
    7146, 
    7147, 
    7148, 
    7307, 
    848, 
    30994, 
    5458, 
    849, 
    8782, 
    887, 
    889, 
    954, 
    989, 
    883, 
    12938, 
    12939, 
    12940, 
    12941, 
    12942, 
    12944, 
    12980, 
    12981, 
    13029, 
    1931, 
    2230, 
    2284, 
    13059, 
    29180, 
    2322, 
    2329, 
    2330, 
    2331, 
    2333, 
    2336, 
    2561, 
    2590, 
    2637, 
    2715, 
    2723, 
    28664, 
    28699, 
    28751, 
    29010, 
    28752, 
    29024, 
    29175, 
    29179, 
    29181, 
    29387, 
    29624, 
    30577, 
    29707, 
    30541, 
    3001, 
    30300, 
    30543, 
    3102, 
    3107, 
    311, 
    13024, 
    13025, 
    13026, 
    2219, 
    2220, 
    3110, 
    3111, 
    30461, 
    30462, 
    30465, 
    30466, 
    30467, 
    30470, 
    3116, 
    3117, 
    3572, 
    3657, 
    884, 
    967, 
    32397, 
    972, 
    33206, 
    984
  ) 
  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 prices.usergroup_id IN (0, 0, 1) 
GROUP BY 
  products.product_id 
ORDER BY 
  popularity.total desc, 
  product_id ASC 
LIMIT 
  288, 36

Query time 0.13285

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "332.00"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "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": 306,
              "rows_produced_per_join": 6,
              "filtered": "2.00",
              "cost_info": {
                "read_cost": "296.14",
                "eval_cost": "0.61",
                "prefix_cost": "296.75",
                "data_read_per_join": "15K"
              },
              "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 (285,1017,1019,1021,1022,1117,1149,1169,1231,12963,1297,13058,13060,1321,1328,1334,1337,34553,5466,6559,6563,7180,1569,28750,30002,30005,34391,34703,36071,36073,37603,41289,5109,7382,1449,14928,14939,14966,30592,15013,15016,23396,28617,28627,2464,2645,28020,28563,28614,28650,28651,28652,28653,28654,29029,29114,29708,29709,30388,2995,11917,2535,28375,28376,28964,3005,34536,5076,5081,5087,30714,5097,5098,5100,5167,5467,5773,5774,6942,7109,7158,7159,7160,7161,7222,30093,30411,30412,30413,30414,30415,30416,30417,30418,30419,30420,30421,30424,30425,30426,30427,30428,30429,30430,30431,30432,30433,30434,30435,30436,30437,30438,30439,30440,30441,30442,30443,30444,30445,30446,30447,30448,30449,30450,30451,30452,30453,30454,30455,30456,30457,30458,30459,30422,30423,3100,1576,1616,2481,2483,2498,2631,2771,28669,28692,32231,32558,33323,34537,3579,42904,4496,5437,5603,5606,5683,5687,5688,5691,5693,8787,921,3662,1084,1601,2063,2529,28686,32403,32404,32405,32406,5083,5685,5077,2778,28657,28658,28758,28759,5079,5080,5158,5459,6574,6623,5190,5548,5554,6333,14789,15306,15307,15309,15311,28615,6334,6335,6336,6337,6338,6339,6644,6765,6793,7347,6766,29009,6767,6768,6769,6770,6771,6772,6773,7308,7324,7325,8788,7132,7133,7134,41366,7220,7146,7147,7148,7307,848,30994,5458,849,8782,887,889,954,989,883,12938,12939,12940,12941,12942,12944,12980,12981,13029,1931,2230,2284,13059,29180,2322,2329,2330,2331,2333,2336,2561,2590,2637,2715,2723,28664,28699,28751,29010,28752,29024,29175,29179,29181,29387,29624,30577,29707,30541,3001,30300,30543,3102,3107,311,13024,13025,13026,2219,2220,3110,3111,30461,30462,30465,30466,30467,30470,3116,3117,3572,3657,884,967,32397,972,33206,984)) 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": 119,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "4.53",
                "eval_cost": "11.92",
                "prefix_cost": "313.20",
                "data_read_per_join": "1K"
              },
              "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": 5,
              "filtered": "5.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.60",
                "prefix_cost": "325.12",
                "data_read_per_join": "26K"
              },
              "used_columns": [
                "product_id",
                "status",
                "amount",
                "usergroup_ids",
                "tracking",
                "stoc_intern",
                "pret_achizitie",
                "pret_revanzator",
                "gestiune"
              ],
              "attached_condition": "((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`))) and (`maniamall_cscart`.`products`.`status` = 'A'))"
            }
          },
          {
            "table": {
              "table_name": "shared_descr",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "product_id",
                "company_id"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id",
                "lang_code",
                "company_id"
              ],
              "key_length": "13",
              "ref": [
                "maniamall_cscart.products_categories.product_id",
                "const",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 5,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.60",
                "prefix_cost": "325.72",
                "data_read_per_join": "22K"
              },
              "used_columns": [
                "product_id",
                "lang_code",
                "company_id",
                "product"
              ]
            }
          },
          {
            "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": [
                "maniamall_cscart.products_categories.product_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 5,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.60",
                "prefix_cost": "326.32",
                "data_read_per_join": "22K"
              },
              "used_columns": [
                "product_id",
                "lang_code",
                "product"
              ]
            }
          },
          {
            "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": 5,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.60",
                "prefix_cost": "326.91",
                "data_read_per_join": "190"
              },
              "used_columns": [
                "product_id",
                "total"
              ]
            }
          },
          {
            "table": {
              "table_name": "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": 1,
              "filtered": "25.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "4.50",
                "eval_cost": "0.15",
                "prefix_cost": "332.01",
                "data_read_per_join": "35"
              },
              "used_columns": [
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "attached_condition": "((`maniamall_cscart`.`prices`.`lower_limit` = 1) and (`maniamall_cscart`.`prices`.`usergroup_id` in (0,0,1)))"
            }
          }
        ]
      }
    }
  }
}

Result

product_id product stoc_intern pret_achizitie pret_revanzator gestiune
1231444 Tambur MTC H buton ALBASTRU -99 0.00 0.00 Y
1232132 Fir trimer/MTC cu insertie metalica 10M 3mm -99 0.00 0.00 Y
2382470 Coronita artificiala de Craciun cu diferite decoratiuni, Diametru 35 cm -99 20.54 35.00 Y
1231619 Sprocket .3/8-7 MARE -99 0.00 0.00 Y
1231934 Foarfec vie YETI -99 0.00 0.00 Y
1232067 Matrita pentru granulator de furaje 2mm -99 0.00 0.00 Y
1232342 Cot Compres Redus Ø32*25 10buc/pg -99 0.00 0.00 Y
1129861 Perna de sezut pentru banca 75 cm Lungime x 40 cm latime, culoare Rosu -99 0.00 55.00 Y
1232255 Foarfece de cules legume/fructe 50mm curbata -99 0.00 0.00 Y
1232131 Fir trimer/MTC cu insertie metalica 10M 2.7mm -99 0.00 0.00 Y
1231263 Moara desfacat porumb electrica 40-90 1.5KW -99 0.00 0.00 Y
1231700 Fir trimer STEA 2.0mm x 15m -99 0.00 0.00 Y
1231061 Sprocket .325-7 MINI -99 0.00 0.00 Y
1129864 Perna de sezut pentru banca 75 cm Lungime x 40 cm latime, culoare Alb -99 0.00 55.00 Y
1231062 Sprocket .325-7 -99 0.00 0.00 Y
2310531 Raft din Lemn in stil Loft, suspendat, cu suport pentru Umerase si 5 Carlige pentru agatat Haine, 60x30x31.7 cm, culoare Maro/Negru -99 108.29 172.00 Y
2382443 Set 3 clopotei pentru bradul de Craciun, cu fundite, diametru 5 cm, culoare Auriu -99 3.20 18.00 Y
1231550 Lant drujba Micul Padurar .3/8 picco 26 dinti MPP -99 0.00 0.00 Y
1231689 Sprocket .3/8-7 MIC -99 0.00 0.00 Y
1231916 Lama Micul Padurar H32 4 nituri MPP -99 0.00 0.00 Y
1232118 Fir trimer/MTC patrat 2.7mm x 15m -99 0.00 0.00 Y
1231554 Foarfec vie automata V8B diferite culori (10pcs) -99 0.00 0.00 Y
1232182 Mufa imbinare 3/4" SAYIM MD28, 1 bucata -99 0.00 0.00 Y
1232128 Fir trimer/MTC HELIX 3.5mm x 15m -99 0.00 0.00 Y
2615750 Husa scaun elastica dining/bucatarie, din spandex, culoare negru -99 13.91 29.00 Y
1141555 Hamac Bahama Single pentru curte sau gradina, 1 persoana, dimensiuni 200 x 100 cm, capacitate 100kg, albastru/verde -99 59.37 71.25 Y
2538988 Perna de gradina matlasata cu umplutura moale pentru leagan sau banca, perna sezut 140x60 cm + perna spate 140x50 cm, culoare gri -99 85.83 145.00 Y
2382442 Set 4 clopotei pentru bradul de Craciun, cu fundite, diametru 5.5 cm, culoare Auriu -99 6.58 18.00 Y
1231692 Fir trimer rotund 2.0mm x 15m -99 0.00 0.00 Y
1232127 Fir trimer/MTC HELIX 3.3mm x 15m -99 0.00 0.00 Y
1231275 Piulita pentru drujba H137/5200 -99 0.00 0.00 Y
2462833 Sistem modern pentru usi culisante, glisante cu sina si accesorii din otel, 183 cm, 100kg, Negru Mat -99 177.19 318.00 Y
1198910 TOTAL - Pistol aparat spalat cu presiune - MTO-TGTSG026 -99 0.00 0.00 N
1231186 Banda pentru aparat legat vita, legume, pomi -99 0.00 0.00 Y
1162591 Garnituri Husqvarna: 362, 365, 371, 372 - (3 piese) - MTO-DA0152 -99 0.00 0.00 N
2274249 Prelata Copertina pentru Soare impermeabila, Triunghiulara, Densitate 160 g/mp, Protectie UV, Dimensiune 3.6x3.6x3.6m, Gri Inchis -99 64.13 118.00 Y