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 = 29 
WHERE 
  cscart_products_categories.product_id IN (
    627, 927, 864, 470, 916, 638, 606, 560, 
    625, 1018, 787, 476, 652, 1128, 884, 
    918, 1122, 1125, 1126, 473, 513, 1094, 
    398, 412, 422, 443, 406, 455, 917, 888, 
    618, 636, 553, 429, 901, 459, 410, 552, 
    551, 842, 1123, 912, 910, 911, 913, 914, 
    915, 967, 417, 433, 580, 514, 471, 654, 
    263, 1037, 574, 495, 813, 1086, 844, 
    756, 755, 434, 863, 220, 823, 610, 867, 
    858, 635, 1044, 579, 578, 1127, 1042, 
    868, 517, 938, 946, 456, 559, 542, 407, 
    866, 515, 561, 491, 493, 573, 651, 562, 
    435, 523, 650, 583
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00298

JSON explain

{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "cscart_products_categories",
      "access_type": "range",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "pt",
      "key_length": "3",
      "used_key_parts": ["product_id"],
      "rows": 98,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (627,927,864,470,916,638,606,560,625,1018,787,476,652,1128,884,918,1122,1125,1126,473,513,1094,398,412,422,443,406,455,917,888,618,636,553,429,901,459,410,552,551,842,1123,912,910,911,913,914,915,967,417,433,580,514,471,654,263,1037,574,495,813,1086,844,756,755,434,863,220,823,610,867,858,635,1044,579,578,1127,1042,868,517,938,946,456,559,542,407,866,515,561,491,493,573,651,562,435,523,650,583)"
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["category_id"],
      "ref": ["bacpvdev_db.cscart_products_categories.category_id"],
      "rows": 1,
      "filtered": 100,
      "attached_condition": "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')"
    },
    "table": {
      "table_name": "product_position_source",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "PRIMARY",
      "key_length": "6",
      "used_key_parts": ["category_id", "product_id"],
      "ref": ["const", "bacpvdev_db.cscart_products_categories.product_id"],
      "rows": 1,
      "filtered": 100
    }
  }
}

Result

product_id category_ids position
220 29M 0
263 29M 0
398 29M 0
406 29M 0
407 29M 0
410 29M 0
412 29M 0
417 29M 0
422 29M 0
429 29M 0
433 29M 0
434 29M 0
435 29M 0
443 29M 0
455 29M 0
456 29M 0
459 29M 0
470 29M 0
471 29M 0
473 29M 0
476 29M 0
491 29M 0
493 29M 0
495 29M 0
513 29M 0
514 29M 0
515 29M 0
517 29M 0
523 29M 0
542 29M 0
551 29M 0
552 29M 0
553 29M 0
559 29M 0
560 29M 0
561 29M 0
562 29M 0
573 29M 0
574 29M 0
578 29M 0
579 29M 0
580 29M 0
583 29M 0
606 29M 0
610 29M 0
618 29M 0
625 29M 0
627 29M 0
635 29M 0
636 29M 0
638 29M 0
650 29M 0
651 29M 0
652 29M 0
654 29M 0
755 29M 0
756 29M 0
787 29M 0
813 29M 0
823 29M 0
842 29M 0
844 29M 0
858 29M 0
863 29M 0
864 29M 0
866 29M 0
867 29M 0
868 29M 0
884 29M 0
888 29M 0
901 29M 0
910 29M 0
911 29M 0
912 29M 0
913 29M 0
914 29M 0
915 29M 0
916 29M 0
917 29M 0
918 29M 0
927 29M 0
938 29M 0
946 29M 0
967 29M 0
1018 29M 0
1037 29M 0
1042 29M 0
1044 29M 0
1086 29M 0
1094 29M 0
1122 29M 0
1123 29M 0
1125 29M 0
1126 29M 0
1127 29M 0
1128 29M 0