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 = 7210 
WHERE 
  cscart_products_categories.product_id IN (
    90836, 88757, 89452, 89465, 89473, 89481, 
    85734, 89969, 90839, 90841, 91535, 
    87505, 87521, 88454, 88471, 88487, 
    88242, 88246, 89457, 89021, 88978, 
    88995, 87537, 88422, 89839, 89891, 
    89963, 91529, 84701, 88959, 88960, 
    88962, 88523, 87547, 88406, 88676, 
    88723, 88569, 85726, 85743, 85753, 
    85763, 85801, 85802, 87518, 87534, 
    88450, 88467, 88483, 85722, 85739, 
    85749, 85759, 88984, 88193, 88205, 
    88234, 88238, 90837, 89843, 89895, 
    89968, 91534, 85733, 88980, 88997, 
    88662, 88709, 84700, 85670, 85690, 
    85702, 85714, 88495, 88961, 91437, 
    91451, 85719, 88717, 85800, 88755, 
    88756, 85678, 87506, 87517, 87522, 
    87533, 88453, 88470, 88486, 88567, 
    89837, 89889, 89961, 91527, 88522
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01704

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "137.02"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "11.31"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "data_read_per_join": "21K"
            },
            "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": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 11,
            "filtered": "1.16",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "1.13",
              "prefix_cost": "121.75",
              "data_read_per_join": "181"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (90836,88757,89452,89465,89473,89481,85734,89969,90839,90841,91535,87505,87521,88454,88471,88487,88242,88246,89457,89021,88978,88995,87537,88422,89839,89891,89963,91529,84701,88959,88960,88962,88523,87547,88406,88676,88723,88569,85726,85743,85753,85763,85801,85802,87518,87534,88450,88467,88483,85722,85739,85749,85759,88984,88193,88205,88234,88238,90837,89843,89895,89968,91534,85733,88980,88997,88662,88709,84700,85670,85690,85702,85714,88495,88961,91437,91451,85719,88717,85800,88755,88756,85678,87506,87517,87522,87533,88453,88470,88486,88567,89837,89889,89961,91527,88522))"
          }
        },
        {
          "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": 11,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.83",
              "eval_cost": "1.13",
              "prefix_cost": "125.71",
              "data_read_per_join": "181"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
84700 7208M,7241,7309,7346
84701 7208M,7241,7309,7346
85670 7210,7211,7214M 0
85678 7210,7211,7214M 0
85690 7210,7211,7214M 0
85702 7210,7211,7214M 0
85714 7210,7211,7214M 0
85719 7210,7211,7212M 0
85722 7210,7211,7212M 0
85726 7210,7211,7214M 0
85733 7210,7211,7214M 0
85734 7210,7211,7214M 0
85739 7210,7211,7212M 0
85743 7210,7211,7214M 0
85749 7210,7211,7212M 0
85753 7210,7211,7214M 0
85759 7210,7211,7212M 0
85763 7210,7211,7214M 0
85800 7208M,7241,7309,7346
85801 7208M,7241,7309,7346
85802 7208M,7241,7309,7346
87505 7210,7211,7212M 0
87506 7210,7211,7212M 0
87517 7210,7211,7214M 0
87518 7210,7211,7214M 0
87521 7210,7211,7212M 0
87522 7210,7211,7212M 0
87533 7210,7211,7214M 0
87534 7210,7211,7214M 0
87537 7210,7211,7212M 0
87547 7210,7211,7214M 0
88193 7210,7211,7212M 0
88205 7210,7211,7212M 0
88234 7210,7211,7214M 0
88238 7210,7211,7214M 0
88242 7210,7211,7214M 0
88246 7210,7211,7214M 0
88406 7210,7211,7214M 0
88422 7210,7211,7212M 0
88450 7210,7211,7214M 0
88453 7210,7211,7212M 0
88454 7210,7211,7212M 0
88467 7210,7211,7214M 0
88470 7210,7211,7212M 0
88471 7210,7211,7212M 0
88483 7210,7211,7214M 0
88486 7210,7211,7212M 0
88487 7210,7211,7212M 0
88495 7210,7211,7212M 0
88522 7210,7211,7212M 0
88523 7210,7211,7212M 0
88567 7210,7211,7214M 0
88569 7210,7211,7214M 0
88662 7210,7211,7282M 0
88676 7210,7211,7214M 0
88709 7210,7211,7282M 0
88717 7210,7211,7282M 0
88723 7210,7211,7214M 0
88755 7210,7211,7282M 0
88756 7210,7211,7282M 0
88757 7210,7211,7282M 0
88959 7208M,7241,7309,7346
88960 7208M,7241,7309,7346
88961 7208M,7241,7309,7346
88962 7208M,7241,7309,7346
88978 7210,7211,7214M 0
88980 7210,7211,7212M 0
88984 7210,7211,7214M 0
88995 7210,7211,7214M 0
88997 7210,7211,7212M 0
89021 7210,7211,7212M 0
89452 7210,7211,7214M 0
89457 7210,7211,7214M 0
89465 7210,7211,7214M 0
89473 7210,7211,7214M 0
89481 7210,7211,7214M 0
89837 7210,7211,7212M 0
89839 7210,7211,7212M 0
89843 7210,7211,7214M 0
89889 7210,7211,7212M 0
89891 7210,7211,7212M 0
89895 7210,7211,7214M 0
89961 7210,7211,7212M 0
89963 7210,7211,7212M 0
89968 7210,7211,7214M 0
89969 7210,7211,7214M 0
90836 7210,7211,7212M 0
90837 7210,7211,7214M 0
90839 7210,7211,7214M 0
90841 7210,7211,7214M 0
91437 7210M,7211 0
91451 7210M,7211 0
91527 7210M,7211 0
91529 7210M,7211 0
91534 7210M,7211 0
91535 7210M,7211 0