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 = 7257 
WHERE 
  cscart_products_categories.product_id IN (
    88088, 87875, 87937, 90323, 87950, 87959, 
    90826, 87952, 88004, 88056, 88057, 
    88058, 87998, 88000, 88037, 90329, 
    90330, 90331, 90333, 90334, 90337, 
    90338, 90339, 90340, 90341, 90342, 
    90345, 90346, 90347, 90348, 87881, 
    88031, 87948, 88059, 88060, 89985, 
    87945, 89986, 88041, 87940, 87942, 
    87964, 90328, 90332, 90335, 90336, 
    90343, 90344, 88029, 88018, 88021, 
    88006, 88013, 88015, 87972, 88091, 
    88055, 88085, 90327, 88071, 88076, 
    88090, 87944, 88072, 88154, 87874, 
    87880, 87873, 90317, 90319, 90320, 
    88087, 87960, 88030, 88086, 88019, 
    87992, 88001, 88005, 87939, 87989, 
    87943, 87973, 87999, 90808, 87965, 
    88014, 88020, 92893, 92894, 93002, 
    93003, 93004, 93005, 93006, 93007
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01603

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "133.61"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "8.79"
      },
      "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": 8,
            "filtered": "0.90",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.88",
              "prefix_cost": "121.75",
              "data_read_per_join": "140"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (88088,87875,87937,90323,87950,87959,90826,87952,88004,88056,88057,88058,87998,88000,88037,90329,90330,90331,90333,90334,90337,90338,90339,90340,90341,90342,90345,90346,90347,90348,87881,88031,87948,88059,88060,89985,87945,89986,88041,87940,87942,87964,90328,90332,90335,90336,90343,90344,88029,88018,88021,88006,88013,88015,87972,88091,88055,88085,90327,88071,88076,88090,87944,88072,88154,87874,87880,87873,90317,90319,90320,88087,87960,88030,88086,88019,87992,88001,88005,87939,87989,87943,87973,87999,90808,87965,88014,88020,92893,92894,93002,93003,93004,93005,93006,93007))"
          }
        },
        {
          "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.20",
              "eval_cost": "0.88",
              "prefix_cost": "124.82",
              "data_read_per_join": "140"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
87873 7208M,7241,7309,7346
87874 7208M,7241,7309,7346
87875 7208M,7241,7309,7346
87880 7208M,7241,7309,7346
87881 7208M,7241,7309,7346
87937 7259M,7345,7347
87939 7261M,7349
87940 7256M,7262
87942 7260M,7320
87943 7261M,7349
87944 7260M,7320
87945 7260M,7320
87948 7259M,7345,7347
87950 7259M,7345,7347
87952 7259M,7345,7347
87959 7260M,7320
87960 7261M,7349
87964 7260M,7320
87965 7261M,7349
87972 7260M,7320
87973 7261M,7349
87989 7261M,7349
87992 7261M,7349
87998 7260M,7320
87999 7261M,7349
88000 7260M,7320
88001 7261M,7349
88004 7259M,7345,7347
88005 7261M,7349
88006 7260M,7320
88013 7260M,7320
88014 7261M,7349
88015 7260M,7320
88018 7260M,7320
88019 7261M,7349
88020 7261M,7349
88021 7260M,7320
88029 7259M,7345,7347
88030 7261M,7349
88031 7260M,7320
88037 7256M,7262
88041 7261M,7349
88055 7261M,7349
88056 7256M,7262
88057 7256M,7262
88058 7256M,7262
88059 7256M,7262
88060 7256M,7262
88071 7261M,7349
88072 7261M,7349
88076 7261M,7349
88085 7261M,7349
88086 7256M,7262
88087 7256M,7262
88088 7256M,7262
88090 7256M,7262
88091 7256M,7262
88154 7260M,7320
89985 7261M,7349
89986 7261M,7349
90317 7247M,7265
90319 7247M,7265
90320 7247M,7265
90323 7247M,7265
90327 7247M,7265
90328 7247M,7265
90329 7247M,7265
90330 7247M,7265
90331 7247M,7265
90332 7247M,7265
90333 7247M,7265
90334 7247M,7265
90335 7247M,7265
90336 7247M,7265
90337 7247M,7265
90338 7247M,7265
90339 7247M,7265
90340 7247M,7265
90341 7247M,7265
90342 7247M,7265
90343 7247M,7265
90344 7247M,7265
90345 7247M,7265
90346 7247M,7265
90347 7247M,7265
90348 7247M,7265
90808 7261M,7349
90826 7208M,7241,7309,7346
92893 7208M,7241,7309,7346
92894 7208M,7241,7309,7346
93002 7208M,7241,7309,7346
93003 7208M,7241,7309,7346
93004 7208M,7241,7309,7346
93005 7208M,7241,7309,7346
93006 7208M,7241,7309,7346
93007 7208M,7241,7309,7346