SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  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_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 7148 
WHERE 
  cscart_products_categories.product_id IN (
    92337, 92338, 92339, 92340, 88093, 84704, 
    84707, 91054, 90824, 90825, 89173, 
    91839, 87232, 87233, 87237, 87238, 
    87242, 87243, 87247, 87248, 88509, 
    88513, 88950, 88951, 88952, 90321, 
    90322, 92450, 92451, 92452, 92453, 
    92454, 92455, 92456, 91838, 86859, 
    88142, 88145, 88520, 91885, 87878, 
    91837, 91886, 91887, 92329, 92330, 
    92331, 92332, 92500, 86278, 86279, 
    82385, 82362, 84696, 88938, 84699, 
    88516, 88519, 88949, 92000, 85039, 
    92424, 92425, 92426, 92427, 92428, 
    92429, 92431, 88940, 84251, 84256, 
    87580, 87595, 87610, 88791, 87370, 
    89609, 89610, 84703, 84706, 91053, 
    92432, 92433, 92434, 92435, 92436, 
    92437, 92438, 88941, 88512, 92173, 
    92174, 92395, 92396, 92397, 92398
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00248

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "144.50"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 254,
            "rows_produced_per_join": 254,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "25.75",
              "eval_cost": "25.40",
              "prefix_cost": "51.15",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (92337,92338,92339,92340,88093,84704,84707,91054,90824,90825,89173,91839,87232,87233,87237,87238,87242,87243,87247,87248,88509,88513,88950,88951,88952,90321,90322,92450,92451,92452,92453,92454,92455,92456,91838,86859,88142,88145,88520,91885,87878,91837,91886,91887,92329,92330,92331,92332,92500,86278,86279,82385,82362,84696,88938,84699,88516,88519,88949,92000,85039,92424,92425,92426,92427,92428,92429,92431,88940,84251,84256,87580,87595,87610,88791,87370,89609,89610,84703,84706,91053,92432,92433,92434,92435,92436,92437,92438,88941,88512,92173,92174,92395,92396,92397,92398))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 12,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "63.50",
              "eval_cost": "1.27",
              "prefix_cost": "140.05",
              "data_read_per_join": "33K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 12,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "3.18",
              "eval_cost": "1.27",
              "prefix_cost": "144.50",
              "data_read_per_join": "203"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82362 7301,7151M
82385 7305,7160M
84251 7194M
84256 7194M
84696 7241,7309,7346,7208M
84699 7241,7309,7346,7208M
84703 7241,7309,7346,7208M
84704 7241,7309,7346,7208M
84706 7241,7309,7346,7208M
84707 7241,7309,7346,7208M
85039 7341,7342,7343,7157M
86278 7148,7163,7164M 0
86279 7148,7163,7164M 0
86859 7148,7207M 0
87232 7194M
87233 7194M
87237 7194M
87238 7194M
87242 7194M
87243 7194M
87247 7194M
87248 7194M
87370 7341,7342,7343,7157M
87580 7194M
87595 7194M
87610 7194M
87878 7241,7309,7346,7208M
88093 7148,7158M 0
88142 7241,7309,7346,7208M
88145 7241,7309,7346,7208M
88509 7241,7309,7346,7208M
88512 7241,7309,7346,7208M
88513 7241,7309,7346,7208M
88516 7241,7309,7346,7208M
88519 7241,7309,7346,7208M
88520 7148,7207,7208M 0
88791 7194M
88938 7241,7309,7346,7208M
88940 7241,7309,7346,7208M
88941 7241,7309,7346,7208M
88949 7148,7207,7208M 0
88950 7241,7309,7346,7208M
88951 7241,7309,7346,7208M
88952 7241,7309,7346,7208M
89173 7265,7247M
89609 7341,7342,7343,7157M
89610 7341,7342,7343,7157M
90321 7265,7247M
90322 7265,7247M
90824 7194M
90825 7194M
91053 7241,7309,7346,7208M
91054 7241,7309,7346,7208M
91837 7341,7342,7343,7157M
91838 7341,7342,7343,7157M
91839 7341,7342,7343,7157M
91885 7226,7225M
91886 7226,7225M
91887 7226,7225M
92000 7226,7225M
92173 7156,7157,7148M 0
92174 7156,7157,7148M 0
92329 7226,7225M
92330 7226,7225M
92331 7226,7225M
92332 7226,7225M
92337 7341,7342,7343,7157M
92338 7341,7342,7343,7157M
92339 7341,7342,7343,7157M
92340 7341,7342,7343,7157M
92395 7156,7157,7148M 0
92396 7156,7157,7148M 0
92397 7156,7157,7148M 0
92398 7156,7157,7148M 0
92424 7263M
92425 7263M
92426 7263M
92427 7263M
92428 7263M
92429 7263M
92431 7263M
92432 7263M
92433 7263M
92434 7263M
92435 7263M
92436 7263M
92437 7263M
92438 7263M
92450 7341,7342,7343,7157M
92451 7341,7342,7343,7157M
92452 7341,7342,7343,7157M
92453 7341,7342,7343,7157M
92454 7341,7342,7343,7157M
92455 7341,7342,7343,7157M
92456 7341,7342,7343,7157M
92500 7341,7342,7343,7157M