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 = 7261 
WHERE 
  cscart_products_categories.product_id IN (
    88078, 89985, 89986, 88041, 88055, 88085, 
    88071, 88076, 88072, 87960, 88030, 
    88019, 87992, 88001, 88005, 87939, 
    87989, 87943, 87973, 87999, 90808, 
    87965, 88014, 88020, 94485, 94492, 
    94510, 94574, 94579, 95757, 95759, 
    95773, 95777, 95827, 95828, 97609, 
    97616, 97634, 97698, 97703, 99113, 
    99117, 99131, 99135, 99144, 99165, 
    99168, 99174, 99176, 99179, 99193, 
    99198, 99199, 99208, 99219, 99233, 
    99249, 99250, 99254, 99256, 99263, 
    99275, 99279, 99345, 100674, 100675, 
    101682, 101683
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00652

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "128.89"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "5.29"
      },
      "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": 5,
            "filtered": "0.54",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.53",
              "prefix_cost": "121.75",
              "data_read_per_join": "84"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (88078,89985,89986,88041,88055,88085,88071,88076,88072,87960,88030,88019,87992,88001,88005,87939,87989,87943,87973,87999,90808,87965,88014,88020,94485,94492,94510,94574,94579,95757,95759,95773,95777,95827,95828,97609,97616,97634,97698,97703,99113,99117,99131,99135,99144,99165,99168,99174,99176,99179,99193,99198,99199,99208,99219,99233,99249,99250,99254,99256,99263,99275,99279,99345,100674,100675,101682,101683))"
          }
        },
        {
          "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": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.32",
              "eval_cost": "0.53",
              "prefix_cost": "123.60",
              "data_read_per_join": "84"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
87939 7261M,7349 0
87943 7261M,7349 0
87960 7261M,7349 0
87965 7261M,7349 0
87973 7261M,7349 0
87989 7261M,7349 0
87992 7261M,7349 0
87999 7261M,7349 0
88001 7261M,7349 0
88005 7261M,7349 0
88014 7261M,7349 0
88019 7261M,7349 0
88020 7261M,7349 0
88030 7261M,7349 0
88041 7261M,7349 0
88055 7261M,7349 0
88071 7261M,7349 0
88072 7261M,7349 0
88076 7261M,7349 0
88078 7261M,7349 0
88085 7261M,7349 0
89985 7261M,7349 0
89986 7261M,7349 0
90808 7261M,7349 0
94485 7261M,7349 0
94492 7261M,7349 0
94510 7261M,7349 0
94574 7261M,7349 0
94579 7261M,7349 0
95757 7261M,7349 0
95759 7261M,7349 0
95773 7261M,7349 0
95777 7261M,7349 0
95827 7261M,7349 0
95828 7261M,7349 0
97609 7261M,7349 0
97616 7261M,7349 0
97634 7261M,7349 0
97698 7261M,7349 0
97703 7261M,7349 0
99113 7261M,7349 0
99117 7261M,7349 0
99131 7261M,7349 0
99135 7261M,7349 0
99144 7261M,7349 0
99165 7261M,7349 0
99168 7261M,7349 0
99174 7261M,7349 0
99176 7261M,7349 0
99179 7261M,7349 0
99193 7261M,7349 0
99198 7261M,7349 0
99199 7261M,7349 0
99208 7261M,7349 0
99219 7261M,7349 0
99233 7261M,7349 0
99249 7261M,7349 0
99250 7261M,7349 0
99254 7261M,7349 0
99256 7261M,7349 0
99263 7261M,7349 0
99275 7261M,7349 0
99279 7261M,7349 0
99345 7261M,7349 0
100674 7261M,7349 0
100675 7261M,7349 0
101682 7261M,7349 0
101683 7261M,7349 0