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 = 7186 
WHERE 
  cscart_products_categories.product_id IN (
    83999, 84001, 84003, 84005, 92051, 92052, 
    92053, 92054, 92055, 92056, 92057, 
    89643, 83998, 84000, 84002, 84004, 
    84034, 89617, 89630, 83955, 83957, 
    83959, 83961, 92139, 92140, 92141, 
    92142, 92143, 92144, 92145, 84026, 
    84027, 84028, 84029, 89626, 89639, 
    89652, 89523, 91308, 92050, 92138, 
    83954, 83956, 83958, 83960, 90061, 
    89623, 89636, 90106, 89649, 91304, 
    83982, 83983, 83984, 83985, 89187, 
    90081, 89485, 83128, 89619, 89632, 
    89645, 83103, 85530, 84109, 83986, 
    83987, 83988, 83989, 90087, 90097, 
    92011, 92012, 92013, 92014, 92015, 
    92016, 92017, 92099, 92100, 92101, 
    92102, 92103, 92104, 92105, 86219, 
    89723, 83109, 83119, 91299, 90069, 
    83091, 91310, 86387, 84098, 91309
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00214

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "62.72"
    },
    "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": 110,
            "rows_produced_per_join": 110,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "11.30",
              "eval_cost": "11.00",
              "prefix_cost": "22.30",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (83999,84001,84003,84005,92051,92052,92053,92054,92055,92056,92057,89643,83998,84000,84002,84004,84034,89617,89630,83955,83957,83959,83961,92139,92140,92141,92142,92143,92144,92145,84026,84027,84028,84029,89626,89639,89652,89523,91308,92050,92138,83954,83956,83958,83960,90061,89623,89636,90106,89649,91304,83982,83983,83984,83985,89187,90081,89485,83128,89619,89632,89645,83103,85530,84109,83986,83987,83988,83989,90087,90097,92011,92012,92013,92014,92015,92016,92017,92099,92100,92101,92102,92103,92104,92105,86219,89723,83109,83119,91299,90069,83091,91310,86387,84098,91309))"
          }
        },
        {
          "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": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "27.50",
              "eval_cost": "0.55",
              "prefix_cost": "60.80",
              "data_read_per_join": "14K"
            },
            "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": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.38",
              "eval_cost": "0.55",
              "prefix_cost": "62.72",
              "data_read_per_join": "88"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
83091 7186M 0
83103 7186M 0
83109 7186M 0
83119 7186M 0
83128 7186M 0
83954 7186M 0
83955 7186M 0
83956 7186M 0
83957 7186M 0
83958 7186M 0
83959 7186M 0
83960 7186M 0
83961 7186M 0
83982 7186M 0
83983 7186M 0
83984 7186M 0
83985 7186M 0
83986 7186M 0
83987 7186M 0
83988 7186M 0
83989 7186M 0
83998 7186M 0
83999 7186M 0
84000 7186M 0
84001 7186M 0
84002 7186M 0
84003 7186M 0
84004 7186M 0
84005 7186M 0
84026 7186M 0
84027 7186M 0
84028 7186M 0
84029 7186M 0
84034 7186M 0
84098 7186M 0
84109 7186M 0
85530 7186M 0
86219 7186M 0
86387 7186M 0
89187 7186M 0
89485 7186M 0
89523 7186M 0
89617 7186M 0
89619 7186M 0
89623 7186M 0
89626 7186M 0
89630 7186M 0
89632 7186M 0
89636 7186M 0
89639 7186M 0
89643 7186M 0
89645 7186M 0
89649 7186M 0
89652 7186M 0
89723 7186M 0
90061 7186M 0
90069 7186M 0
90081 7186M 0
90087 7186M 0
90097 7186M 0
90106 7186M 0
91299 7186M 0
91304 7186M 0
91308 7186M 0
91309 7186M 0
91310 7186M 0
92011 7186,7184M 0
92012 7186,7184M 0
92013 7186,7184M 0
92014 7186,7184M 0
92015 7186,7184M 0
92016 7186,7184M 0
92017 7186,7184M 0
92050 7186M 0
92051 7186M 0
92052 7186M 0
92053 7186M 0
92054 7186M 0
92055 7186M 0
92056 7186M 0
92057 7186M 0
92099 7186,7184M 0
92100 7186,7184M 0
92101 7186,7184M 0
92102 7186,7184M 0
92103 7186,7184M 0
92104 7186,7184M 0
92105 7186,7184M 0
92138 7186M 0
92139 7186M 0
92140 7186M 0
92141 7186M 0
92142 7186M 0
92143 7186M 0
92144 7186M 0
92145 7186M 0