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 = 7165 
WHERE 
  cscart_products_categories.product_id IN (
    94016, 94017, 94018, 94019, 94020, 94021, 
    94022, 94080, 94081, 94082, 94083, 
    94084, 94085, 94086, 94087, 94088, 
    94089, 94090, 94091, 94092, 94093, 
    94094, 94095, 94096, 94097, 94098, 
    94099, 94100, 94101, 94102, 94103, 
    94104, 94105, 94106, 94107, 94108, 
    94109, 94110, 94111, 94112, 94113, 
    94114, 94115, 94116, 94117, 94118, 
    94165, 94166, 94167, 94168, 94169, 
    94170, 94171, 94172, 94173, 94174, 
    94175, 94176, 94177, 94178, 94179, 
    94180, 94181, 94182, 94183, 94184, 
    94185, 94186, 94187, 94188, 94189, 
    94190, 94191, 94192, 94193, 94194, 
    94195, 94196, 94197, 94198, 94199, 
    94200, 94201, 94202, 94203, 94204, 
    94205, 94206, 94207, 94208, 94209, 
    94210, 94211, 94212, 94213, 94214
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01340

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "101.10"
    },
    "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": 112,
            "rows_produced_per_join": 112,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "11.50",
              "eval_cost": "11.20",
              "prefix_cost": "22.70",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (94016,94017,94018,94019,94020,94021,94022,94080,94081,94082,94083,94084,94085,94086,94087,94088,94089,94090,94091,94092,94093,94094,94095,94096,94097,94098,94099,94100,94101,94102,94103,94104,94105,94106,94107,94108,94109,94110,94111,94112,94113,94114,94115,94116,94117,94118,94165,94166,94167,94168,94169,94170,94171,94172,94173,94174,94175,94176,94177,94178,94179,94180,94181,94182,94183,94184,94185,94186,94187,94188,94189,94190,94191,94192,94193,94194,94195,94196,94197,94198,94199,94200,94201,94202,94203,94204,94205,94206,94207,94208,94209,94210,94211,94212,94213,94214))"
          }
        },
        {
          "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": 112,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "28.00",
              "eval_cost": "11.20",
              "prefix_cost": "61.90",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "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": "28.00",
              "eval_cost": "0.56",
              "prefix_cost": "101.10",
              "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')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
94016 7168M
94017 7168M
94018 7168M
94019 7168M
94020 7168M
94021 7168M
94022 7168M
94080 7168M
94081 7193M,7319
94082 7193M,7319
94083 7168M
94084 7168M
94085 7193M,7319
94086 7168M
94087 7168M
94088 7193M,7319
94089 7193M,7319
94090 7193M,7319
94091 7168M
94092 7168M
94093 7193M,7319
94094 7168M
94095 7193M,7319
94096 7193M,7319
94097 7193M,7319
94098 7193M,7319
94099 7193M,7319
94100 7168M
94101 7168M
94102 7168M
94103 7168M
94104 7168M
94105 7168M
94106 7168M
94107 7168M
94108 7168M
94109 7168M
94110 7168M
94111 7168M
94112 7168M
94113 7168M
94114 7168M
94115 7168M
94116 7193M,7319
94117 7167M,7183,7283
94118 7193M,7319
94165 7166M
94166 7166M
94167 7166M
94168 7166M
94169 7166M
94170 7166M
94171 7166M
94172 7166M
94173 7166M
94174 7166M
94175 7166M
94176 7166M
94177 7166M
94178 7166M
94179 7166M
94180 7166M
94181 7166M
94182 7166M
94183 7166M
94184 7166M
94185 7166M
94186 7166M
94187 7166M
94188 7166M
94189 7166M
94190 7166M
94191 7166M
94192 7166M
94193 7166M
94194 7166M
94195 7166M
94196 7166M
94197 7166M
94198 7166M
94199 7166M
94200 7166M
94201 7166M
94202 7166M
94203 7166M
94204 7166M
94205 7166M
94206 7166M
94207 7166M
94208 7166M
94209 7166M
94210 7166M
94211 7166M
94212 7166M
94213 7166M
94214 7166M