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 (
    1098, 
    10851, 
    10855, 
    10857, 
    10874, 
    10886, 
    32186, 
    10887, 
    10892, 
    10893, 
    10894, 
    10895, 
    10913, 
    10914, 
    10930, 
    10933, 
    10934, 
    10940, 
    10955, 
    10956, 
    10960, 
    10964, 
    10967, 
    10976, 
    10981, 
    10983, 
    10988, 
    11013, 
    11014, 
    11085, 
    11102, 
    11112, 
    11116, 
    11122, 
    1152, 
    1165, 
    12994, 
    12995, 
    13435, 
    13446, 
    13450, 
    13461, 
    1412, 
    1452, 
    1465, 
    15302, 
    1571, 
    16568, 
    16582, 
    16836, 
    16864, 
    16887, 
    17028, 
    17042, 
    17053, 
    1720, 
    19350, 
    19351, 
    19543, 
    19564, 
    19565, 
    19580, 
    19581, 
    20749, 
    20750, 
    20751, 
    20752, 
    20753, 
    20754, 
    20755, 
    20756, 
    20757, 
    20768, 
    20758, 
    20759, 
    20760, 
    20761, 
    20762, 
    20789, 
    20763, 
    20764, 
    20765, 
    20766, 
    20767, 
    20769, 
    20770, 
    20780, 
    20781, 
    20771, 
    20772, 
    21183, 
    20773, 
    20774, 
    20782, 
    21068, 
    20775, 
    20776, 
    20777, 
    20778, 
    20779, 
    20783, 
    20784, 
    20785, 
    20786, 
    20787, 
    20788, 
    20790, 
    20791, 
    21184, 
    20979, 
    20980, 
    21033, 
    21037, 
    21112, 
    21127, 
    21128, 
    19386, 
    19387, 
    19571, 
    19601, 
    20741, 
    20742, 
    20810, 
    21164, 
    21169, 
    21238, 
    21366, 
    19474, 
    21177, 
    19506, 
    19507, 
    21587, 
    19544, 
    19545, 
    19546, 
    19547, 
    20944, 
    20945, 
    20950, 
    20946, 
    20947, 
    20948, 
    20949, 
    20951, 
    20952, 
    20953, 
    20800, 
    19555, 
    19556, 
    20815, 
    20817, 
    20819, 
    20823, 
    20825, 
    20828, 
    20829, 
    20831, 
    20926, 
    20931, 
    19731, 
    19732, 
    21139, 
    21180, 
    21333, 
    21388, 
    20976, 
    20977, 
    21041, 
    21111, 
    21116, 
    21162, 
    21163, 
    21334, 
    21179, 
    20993, 
    20994, 
    21390, 
    21065, 
    21066, 
    21159, 
    21324, 
    21325, 
    21326, 
    21327, 
    21328, 
    21329, 
    21330, 
    21331, 
    21332, 
    21335, 
    21336, 
    21337, 
    21168, 
    21172, 
    21173, 
    21175, 
    21178, 
    23102, 
    23191, 
    23192, 
    23193, 
    23194, 
    23432, 
    23197, 
    23345, 
    23878, 
    23347, 
    28716, 
    23246, 
    23281, 
    23310, 
    23311, 
    23360, 
    23816, 
    23854, 
    23884, 
    23295, 
    23296, 
    23298, 
    28607, 
    28714, 
    23301, 
    23308, 
    28636, 
    23312, 
    23861, 
    23440, 
    23512, 
    23513, 
    23729, 
    23739, 
    23740, 
    23767, 
    23784, 
    23786, 
    23787, 
    2726, 
    2876, 
    30008, 
    32185, 
    3126, 
    3129, 
    3154, 
    3172, 
    3174, 
    3177, 
    3184, 
    3251, 
    3252, 
    3256, 
    3274, 
    3275, 
    3341, 
    3358, 
    3398, 
    37427, 
    37428, 
    37430, 
    37434, 
    37436, 
    37438, 
    37440, 
    37441, 
    37442, 
    37443, 
    37444, 
    37445, 
    37446, 
    37447, 
    37449, 
    37451, 
    37452, 
    37453, 
    37455, 
    37456, 
    37457, 
    37458, 
    37459, 
    37460, 
    37461, 
    37462, 
    37463, 
    37464, 
    37465, 
    37466, 
    37467, 
    37468, 
    37469, 
    37470, 
    37471, 
    37472, 
    37473, 
    37474, 
    37475, 
    37476, 
    37477, 
    37478, 
    37482, 
    37483, 
    37484, 
    37485, 
    37486, 
    37487, 
    37488, 
    37489, 
    37490, 
    37491, 
    37492, 
    37494, 
    37495, 
    37497, 
    37500, 
    37501, 
    37502, 
    37503, 
    37505, 
    37506, 
    37509, 
    37510, 
    37511, 
    37514, 
    37515, 
    37519, 
    37520, 
    37521, 
    37522, 
    37523, 
    37524, 
    37526, 
    37527, 
    37528, 
    37529, 
    37530, 
    37531, 
    37532, 
    37533, 
    37534, 
    37535, 
    37536, 
    37537, 
    37538, 
    37539, 
    37540, 
    37541, 
    37542, 
    37543, 
    37544, 
    37545, 
    37546, 
    37547, 
    37549, 
    37550, 
    37551, 
    37553, 
    37554, 
    37555, 
    37557, 
    37558, 
    37559, 
    37560, 
    37561, 
    37562, 
    37563, 
    37564, 
    37565, 
    37566, 
    37568, 
    37571, 
    37572, 
    37573, 
    37574, 
    37575, 
    37576, 
    37577, 
    37579, 
    37580, 
    37581, 
    37582, 
    37584, 
    37585, 
    37586, 
    37587, 
    37588, 
    37589, 
    37591, 
    37592, 
    37593, 
    37604, 
    37605, 
    37606, 
    37607, 
    37608, 
    37609, 
    37610, 
    37611, 
    37612, 
    37613, 
    37614, 
    5074, 
    5789, 
    5795, 
    5837, 
    5842, 
    5853, 
    5862, 
    5865, 
    5869, 
    5870, 
    5884, 
    5971, 
    6038, 
    6381, 
    7126, 
    7127, 
    7128, 
    7131, 
    7221, 
    7345, 
    7888, 
    7890, 
    8083, 
    8094, 
    8124, 
    8132, 
    8900
  ) 
  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 
  0, 36

Query time 0.05322

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "382.90"
    },
    "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": 425,
              "rows_produced_per_join": 8,
              "filtered": "2.00",
              "cost_info": {
                "read_cost": "333.07",
                "eval_cost": "0.85",
                "prefix_cost": "333.92",
                "data_read_per_join": "22K"
              },
              "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 (1098,10851,10855,10857,10874,10886,32186,10887,10892,10893,10894,10895,10913,10914,10930,10933,10934,10940,10955,10956,10960,10964,10967,10976,10981,10983,10988,11013,11014,11085,11102,11112,11116,11122,1152,1165,12994,12995,13435,13446,13450,13461,1412,1452,1465,15302,1571,16568,16582,16836,16864,16887,17028,17042,17053,1720,19350,19351,19543,19564,19565,19580,19581,20749,20750,20751,20752,20753,20754,20755,20756,20757,20768,20758,20759,20760,20761,20762,20789,20763,20764,20765,20766,20767,20769,20770,20780,20781,20771,20772,21183,20773,20774,20782,21068,20775,20776,20777,20778,20779,20783,20784,20785,20786,20787,20788,20790,20791,21184,20979,20980,21033,21037,21112,21127,21128,19386,19387,19571,19601,20741,20742,20810,21164,21169,21238,21366,19474,21177,19506,19507,21587,19544,19545,19546,19547,20944,20945,20950,20946,20947,20948,20949,20951,20952,20953,20800,19555,19556,20815,20817,20819,20823,20825,20828,20829,20831,20926,20931,19731,19732,21139,21180,21333,21388,20976,20977,21041,21111,21116,21162,21163,21334,21179,20993,20994,21390,21065,21066,21159,21324,21325,21326,21327,21328,21329,21330,21331,21332,21335,21336,21337,21168,21172,21173,21175,21178,23102,23191,23192,23193,23194,23432,23197,23345,23878,23347,28716,23246,23281,23310,23311,23360,23816,23854,23884,23295,23296,23298,28607,28714,23301,23308,28636,23312,23861,23440,23512,23513,23729,23739,23740,23767,23784,23786,23787,2726,2876,30008,32185,3126,3129,3154,3172,3174,3177,3184,3251,3252,3256,3274,3275,3341,3358,3398,37427,37428,37430,37434,37436,37438,37440,37441,37442,37443,37444,37445,37446,37447,37449,37451,37452,37453,37455,37456,37457,37458,37459,37460,37461,37462,37463,37464,37465,37466,37467,37468,37469,37470,37471,37472,37473,37474,37475,37476,37477,37478,37482,37483,37484,37485,37486,37487,37488,37489,37490,37491,37492,37494,37495,37497,37500,37501,37502,37503,37505,37506,37509,37510,37511,37514,37515,37519,37520,37521,37522,37523,37524,37526,37527,37528,37529,37530,37531,37532,37533,37534,37535,37536,37537,37538,37539,37540,37541,37542,37543,37544,37545,37546,37547,37549,37550,37551,37553,37554,37555,37557,37558,37559,37560,37561,37562,37563,37564,37565,37566,37568,37571,37572,37573,37574,37575,37576,37577,37579,37580,37581,37582,37584,37585,37586,37587,37588,37589,37591,37592,37593,37604,37605,37606,37607,37608,37609,37610,37611,37612,37613,37614,5074,5789,5795,5837,5842,5853,5862,5865,5869,5870,5884,5971,6038,6381,7126,7127,7128,7131,7221,7345,7888,7890,8083,8094,8124,8132,8900)) 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": 165,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "7.00",
                "eval_cost": "16.56",
                "prefix_cost": "357.48",
                "data_read_per_join": "2K"
              },
              "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": 8,
              "filtered": "5.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.83",
                "prefix_cost": "374.04",
                "data_read_per_join": "36K"
              },
              "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": 8,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.83",
                "prefix_cost": "374.87",
                "data_read_per_join": "31K"
              },
              "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": 8,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.83",
                "prefix_cost": "375.70",
                "data_read_per_join": "31K"
              },
              "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": 8,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "0.00",
                "eval_cost": "0.83",
                "prefix_cost": "376.52",
                "data_read_per_join": "264"
              },
              "used_columns": [
                "product_id",
                "total"
              ]
            }
          },
          {
            "table": {
              "table_name": "prices",
              "access_type": "ref",
              "possible_keys": [
                "usergroup",
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "key": "lower_limit",
              "used_key_parts": [
                "lower_limit",
                "product_id"
              ],
              "key_length": "6",
              "ref": [
                "const",
                "maniamall_cscart.products_categories.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 4,
              "filtered": "50.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "5.55",
                "eval_cost": "0.41",
                "prefix_cost": "382.90",
                "data_read_per_join": "99"
              },
              "used_columns": [
                "product_id",
                "lower_limit",
                "usergroup_id"
              ],
              "attached_condition": "(`maniamall_cscart`.`prices`.`usergroup_id` in (0,0,1))"
            }
          }
        ]
      }
    }
  }
}

Result

product_id product stoc_intern pret_achizitie pret_revanzator gestiune
480519 Kit pentru Reparatie Parbriz sau Geam Auto -99 17.10 44.00 Y
524885 Priza Remorca Auto cu Adaptor Inclus pentru 7 sau 13 Pini -99 7.12 16.00 Y
697773 Pompa amorsare auto cu cot ManiaCars -99 14.09 0.00 Y
866373 Incarcator auto wireless, cu suport inchidere/deschidere automata, incarcare prin inductie electromagnetica, brat reglabil, negru -99 56.78 68.13 Y
1118377 Covoras Husa Auto de Protectie Bancheta sau Portbagaj pentru Transport Animale, 144x144 cm -99 21.00 19.19 Y
697683 Releu 4 pini 40A 12V ManiaCars -99 2.26 0.00 Y
612103 Filtru aer tuning cu carcasa rosie ManiaCars -99 28.80 0.00 Y
880671 Priza bricheta auto tripla, 12V/24V, cu port USB -99 8.34 10.01 Y
1434961 Antena Auto Ornamentala Universala, tip Rechin, din Plastic, 15x5.5x7cm, culoare Alb -99 1.05 1.18 Y
694679 kit cablaj carlig remorca 7 PINI ManiaCars -99 25.45 0.00 N
822677 Adaptor priza bricheta Blow, 3xUSB, 5.2A, protectie la supratensiune -99 20.71 26.25 Y
614913 Ridicator tensiune pentru FIR NEON ManiaCars -99 5.00 0.00 N
301401 Plasa de depozitare durabila cu cârlige 60 x 60 cm lungime întinsa -99 7.86 25.00 Y
822659 Priza Remorca Auto Blow, cu 7 Pini, 12/24V, culoare argintiu -99 7.31 8.77 Y
613219 Invertor 220v-12v 20A 240W cu ventilator ManiaCars -99 54.55 0.00 N
613221 Invertor 220v-12v 30A 360W cu ventilator ManiaCars -99 70.00 0.00 N
1025388 CAMASA FRANA FATA L=75 - MTO-R50033.2 -99 0.00 0.00 Y
822679 Vesta cu doua dungi reflectorizante, omologata European, culoare portocaliu -99 5.26 6.31 Y
1025367 CABLU FRANA 2m/1.5mm - MTO-BSP0763 -99 0.00 0.00 Y
1025365 CABLU FRANA 2m/1.5mm - MTO-BSP0758 -99 0.00 0.00 Y
1230911 Parasolar auto universal retractabil, pentru parbriz sau luneta, protectie UV, 150x65 cm, gri -99 32.07 38.48 Y
1338749 Set huse scaune fata+spate ART210FS super soft - DIVERSE CULORI -99 160.00 202.00 N
1731846 Eleron portbagaj / haion universal negru lucios COD: UNIV-091 MRA36-040621-19 -99 150.00 0.00 Y
1732251 Rola cheder cu adeziv 4.5 metri COD: 508802/045 MRA36-270121-2 -99 15.45 0.00 N
359020 Organizator Auto pentru Spatarul Scaunului din Fata al Masinii -99 8.00 27.00 Y
1153153 Set chei pentru demontare radio auto Blaupunkt, Phillips compatibil Opel, 2 buc -99 1.73 2.07 Y
1153155 Set chei pentru demontare radio auto, compatibil VW, Audi, 2 buc -99 3.11 3.73 Y
1338924 Suport telefon cu incarcator wireless S5 2in1 -99 40.00 62.00 N
1231165 Camera auto 165-175-185/14"" -99 0.00 0.00 Y
1731742 Abtibild reflectorizant 5cm X 40 T078 MRA36-150621-4 -99 4.09 0.00 Y
1732158 Lada frigorifica termoelectrica capacitate 21L tensiune alimentare 12V putere 48W cu adaptor 220V Breckner Germany BK87829 MRA36-220221-10 -99 250.00 0.00 Y
1231166 Camera auto 600-650/16" -99 0.00 0.00 Y
1732357 Prelata moto/atv, marimea S 1.7*0.6*0.8m MRA36-041220-1 -99 40.00 0.00 Y
1153734 Tester de presiune analogic pt. pneuri - GBZ-55779 Brico DecoHome -99 0.00 9.00 N
1732013 Set 2 becuri halogen H7 Osram Cool Blue Intense 12V, 55W MRA36-120421-1 -99 63.64 0.00 Y
1663556 Opel / Chevrolet - Carcasa tip cheie briceag cu 3 butoane - eChilipir -99 0.00 0.00 N