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 = 7166 
WHERE 
  cscart_products_categories.product_id IN (
    94273, 94274, 94275, 94276, 94277, 94278, 
    94279, 94280, 94281, 94282, 94283, 
    94284, 94285, 94286, 94287, 94288, 
    94289, 94290, 94291, 94292, 94293, 
    94294, 94295, 94296, 94297, 94298, 
    94299, 94300, 94301, 94302, 94303, 
    94304, 94305, 94306, 94307, 94308, 
    94309, 94310, 94311, 94312, 94313, 
    94314, 94315, 94316, 94317, 94318, 
    94319, 94320, 94321, 94322, 94323, 
    94324, 94325, 94326, 94327, 94328, 
    94329, 94330, 94331, 94332, 94958, 
    95034, 95096, 95097, 95098, 95099, 
    95683, 95702, 95703, 96193, 96194, 
    96841, 96917, 96918, 96919, 96981, 
    96982, 96983, 96984, 96998, 98538, 
    98539, 98540, 98541, 98542, 98543, 
    98544, 98545, 98546, 98547, 98548, 
    98549, 100923, 100924, 100925, 100926
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01625

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "129.20"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "5.52"
      },
      "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.56",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.55",
              "prefix_cost": "121.75",
              "data_read_per_join": "88"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (94273,94274,94275,94276,94277,94278,94279,94280,94281,94282,94283,94284,94285,94286,94287,94288,94289,94290,94291,94292,94293,94294,94295,94296,94297,94298,94299,94300,94301,94302,94303,94304,94305,94306,94307,94308,94309,94310,94311,94312,94313,94314,94315,94316,94317,94318,94319,94320,94321,94322,94323,94324,94325,94326,94327,94328,94329,94330,94331,94332,94958,95034,95096,95097,95098,95099,95683,95702,95703,96193,96194,96841,96917,96918,96919,96981,96982,96983,96984,96998,98538,98539,98540,98541,98542,98543,98544,98545,98546,98547,98548,98549,100923,100924,100925,100926))"
          }
        },
        {
          "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": "123.68",
              "data_read_per_join": "88"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
94273 7166M 0
94274 7166M 0
94275 7166M 0
94276 7166M 0
94277 7166M 0
94278 7166M 0
94279 7166M 0
94280 7166M 0
94281 7166M 0
94282 7166M 0
94283 7166M 0
94284 7166M 0
94285 7166M 0
94286 7166M 0
94287 7166M 0
94288 7166M 0
94289 7166M 0
94290 7166M 0
94291 7166M 0
94292 7166M 0
94293 7166M 0
94294 7166M 0
94295 7166M 0
94296 7166M 0
94297 7166M 0
94298 7166M 0
94299 7166M 0
94300 7166M 0
94301 7166M 0
94302 7166M 0
94303 7166M 0
94304 7166M 0
94305 7166M 0
94306 7166M 0
94307 7166M 0
94308 7166M 0
94309 7166M 0
94310 7166M 0
94311 7166M 0
94312 7166M 0
94313 7166M 0
94314 7166M 0
94315 7166M 0
94316 7166M 0
94317 7166M 0
94318 7166M 0
94319 7166M 0
94320 7166M 0
94321 7166M 0
94322 7166M 0
94323 7166M 0
94324 7166M 0
94325 7166M 0
94326 7166M 0
94327 7166M 0
94328 7166M 0
94329 7166M 0
94330 7166M 0
94331 7166M 0
94332 7166M 0
94958 7167M,7183,7283
95034 7166M 0
95096 7166M 0
95097 7166M 0
95098 7166M 0
95099 7166M 0
95683 7167M,7183,7283
95702 7167M,7183,7283
95703 7167M,7183,7283
96193 7193M,7319
96194 7193M,7319
96841 7167M,7183,7283
96917 7166M 0
96918 7167M,7183,7283
96919 7167M,7183,7283
96981 7166M 0
96982 7166M 0
96983 7166M 0
96984 7166M 0
96998 7167M,7183,7283
98538 7167M,7183,7283
98539 7167M,7183,7283
98540 7167M,7183,7283
98541 7167M,7183,7283
98542 7167M,7183,7283
98543 7167M,7183,7283
98544 7167M,7183,7283
98545 7167M,7183,7283
98546 7167M,7183,7283
98547 7167M,7183,7283
98548 7167M,7183,7283
98549 7167M,7183,7283
100923 7193M,7319
100924 7193M,7319
100925 7193M,7319
100926 7193M,7319