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 = 266 
WHERE 
  cscart_products_categories.product_id IN (
    265000, 40404, 262379, 265262, 392209, 
    339537, 114747, 271509, 339493, 265255, 
    339524, 339540, 339536, 339491, 265241, 
    114761, 265230, 339517, 339522, 339526, 
    339520, 285971, 81644, 265236, 81606, 
    81700, 271508, 265251, 271499, 224457, 
    271501, 339490, 392218, 265238, 265240, 
    392216, 265253, 392217, 81601, 366896, 
    339741, 381654, 265243, 265264, 81687, 
    339498, 271507, 339449, 265233, 32880, 
    339528, 224454, 381657, 81703, 391799, 
    265234, 265257, 381658, 339497, 339689, 
    224455, 265259, 285967, 81679, 339448, 
    265249, 265252, 339450, 265260, 359820, 
    339435, 392151, 265239, 285969, 381656, 
    339622, 339442, 381655, 81666, 339616, 
    339443, 152086, 339436, 170242, 339574, 
    259708, 339523, 339507, 205875, 339437, 
    339504, 339451, 339512, 265035, 81683, 
    139611, 339740, 339609, 339500, 339532
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00466

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "289.56"
    },
    "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": 103,
            "rows_produced_per_join": 103,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "21.76",
              "eval_cost": "20.60",
              "prefix_cost": "42.36",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (265000,40404,262379,265262,392209,339537,114747,271509,339493,265255,339524,339540,339536,339491,265241,114761,265230,339517,339522,339526,339520,285971,81644,265236,81606,81700,271508,265251,271499,224457,271501,339490,392218,265238,265240,392216,265253,392217,81601,366896,339741,381654,265243,265264,81687,339498,271507,339449,265233,32880,339528,224454,381657,81703,391799,265234,265257,381658,339497,339689,224455,265259,285967,81679,339448,265249,265252,339450,265260,359820,339435,392151,265239,285969,381656,339622,339442,381655,81666,339616,339443,152086,339436,170242,339574,259708,339523,339507,205875,339437,339504,339451,339512,265035,81683,139611,339740,339609,339500,339532))"
          }
        },
        {
          "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",
              "webmarco.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 103,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "103.00",
              "eval_cost": "20.60",
              "prefix_cost": "165.96",
              "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": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "103.00",
              "eval_cost": "1.03",
              "prefix_cost": "289.56",
              "data_read_per_join": "30K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
32880 267M
40404 267M
81601 2404M
81606 2404M
81644 2404M
81666 2404M
81679 2404M
81683 2404M
81687 2404M
81700 2404M
81703 2404M
114747 342M
114761 342M
139611 2404M
152086 932M
170242 8944M
205875 9623M
224454 2599M
224455 2387M
224457 2387M
259708 2578M
262379 2578M
265000 2374M
265035 1907M
265230 2604M
265233 2604M
265234 2604M
265236 2604M
265238 2604M
265239 2604M
265240 2604M
265241 2604M
265243 2604M
265249 2604M
265251 2604M
265252 2604M
265253 2604M
265255 2604M
265257 2604M
265259 2604M
265260 2604M
265262 2604M
265264 2604M
271499 2599M
271501 2599M
271507 2599M
271508 2599M
271509 2599M
285967 443,356M
285969 443,356M
285971 443,356M
339435 9940M
339436 9940M
339437 9940M
339442 9940M
339443 9940M
339448 9940M
339449 9940M
339450 9940M
339451 9940M
339490 9942M
339491 9942M
339493 9942M
339497 9942M
339498 9942M
339500 9942M
339504 9942M
339507 9942M
339512 9942M
339517 9942M
339520 9942M
339522 9942M
339523 9942M
339524 9942M
339526 9942M
339528 9942M
339532 9942M
339536 9942M
339537 9942M
339540 9942M
339574 9941M
339609 9941M
339616 9941M
339622 9941M
339689 9940M
339740 9941M
339741 9941M
359820 266M 0
366896 2577M
381654 1498M
381655 1498M
381656 1498M
381657 1498M
381658 1498M
391799 266M 0
392151 2577M
392209 443M
392216 443M
392217 443M
392218 443M