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 = 7170 
WHERE 
  cscart_products_categories.product_id IN (
    90997, 85063, 85149, 85195, 85241, 83564, 
    83565, 83077, 83574, 90913, 90992, 
    83057, 83058, 83606, 83607, 89825, 
    89826, 89877, 89878, 89949, 89950, 
    90893, 90894, 90972, 90973, 91515, 
    91516, 85060, 85146, 85192, 85238, 
    86134, 86136, 86157, 86159, 86642, 
    86644, 86711, 86713, 82632, 83529, 
    84543, 84544, 84609, 84610, 85126, 
    86183, 86206, 86507, 86783, 87294, 
    87295, 89078, 90003, 85103, 86131, 
    86154, 86639, 86708, 85850, 85851, 
    85860, 85861, 85089, 85175, 85221, 
    85267, 85100, 83078, 83558, 83563, 
    83575, 90914, 90993, 85061, 85147, 
    85193, 85239, 87314, 87315, 87326, 
    87327, 87338, 87339, 87350, 87351, 
    84324, 84325, 85319, 85416, 85467, 
    85518, 86608, 86677, 82636, 82637
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00285

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "91.12"
    },
    "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": 160,
            "rows_produced_per_join": 160,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "16.32",
              "eval_cost": "16.00",
              "prefix_cost": "32.32",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (90997,85063,85149,85195,85241,83564,83565,83077,83574,90913,90992,83057,83058,83606,83607,89825,89826,89877,89878,89949,89950,90893,90894,90972,90973,91515,91516,85060,85146,85192,85238,86134,86136,86157,86159,86642,86644,86711,86713,82632,83529,84543,84544,84609,84610,85126,86183,86206,86507,86783,87294,87295,89078,90003,85103,86131,86154,86639,86708,85850,85851,85860,85861,85089,85175,85221,85267,85100,83078,83558,83563,83575,90914,90993,85061,85147,85193,85239,87314,87315,87326,87327,87338,87339,87350,87351,84324,84325,85319,85416,85467,85518,86608,86677,82636,82637))"
          }
        },
        {
          "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": 8,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "40.00",
              "eval_cost": "0.80",
              "prefix_cost": "88.32",
              "data_read_per_join": "20K"
            },
            "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": 8,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "2.00",
              "eval_cost": "0.80",
              "prefix_cost": "91.12",
              "data_read_per_join": "128"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
82632 7170,7171M 0
82636 7192M
82637 7192M
83057 7192M
83058 7192M
83077 7170,7191M 0
83078 7170,7191M 0
83529 7170,7171M 0
83558 7170,7171M 0
83563 7170,7171M 0
83564 7170,7171M 0
83565 7170,7171M 0
83574 7170,7191M 0
83575 7170,7191M 0
83606 7192M
83607 7192M
84324 7223M
84325 7223M
84543 7223M
84544 7223M
84609 7223M
84610 7223M
85060 7170,7171M 0
85061 7170,7171M 0
85063 7170,7171M 0
85089 7170,7171M 0
85100 7170,7171M 0
85103 7170,7171M 0
85126 7192M
85146 7170,7171M 0
85147 7170,7171M 0
85149 7170,7171M 0
85175 7170,7171M 0
85192 7170,7171M 0
85193 7170,7171M 0
85195 7170,7171M 0
85221 7170,7171M 0
85238 7170,7171M 0
85239 7170,7171M 0
85241 7170,7171M 0
85267 7170,7171M 0
85319 7192M
85416 7192M
85467 7192M
85518 7192M
85850 7170,7171M 0
85851 7170,7171M 0
85860 7170,7171M 0
85861 7170,7171M 0
86131 7170,7171M 0
86134 7170,7171M 0
86136 7170,7171M 0
86154 7170,7171M 0
86157 7170,7171M 0
86159 7170,7171M 0
86183 7192M
86206 7192M
86507 7192M
86608 7170,7191,7310M 0
86639 7170,7171M 0
86642 7170,7171M 0
86644 7170,7171M 0
86677 7170,7191,7310M 0
86708 7170,7171M 0
86711 7170,7171M 0
86713 7170,7171M 0
86783 7192M
87294 7170,7171M 0
87295 7170,7171M 0
87314 7170,7171M 0
87315 7170,7171M 0
87326 7170,7171M 0
87327 7170,7171M 0
87338 7170,7171M 0
87339 7170,7171M 0
87350 7170,7171M 0
87351 7170,7171M 0
89078 7192M
89825 7192M
89826 7192M
89877 7192M
89878 7192M
89949 7192M
89950 7192M
90003 7170,7191M 0
90893 7192M
90894 7192M
90913 7191,7170M 0
90914 7191,7170M 0
90972 7192M
90973 7192M
90992 7191,7170M 0
90993 7191,7170M 0
90997 7191,7170M 0
91515 7192M
91516 7192M