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
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00187

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": 50,
      "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)"
    },
    "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
398 29M 0
406 29M 0
410 29M 0
412 29M 0
422 29M 0
429 29M 0
443 29M 0
455 29M 0
459 29M 0
470 29M 0
473 29M 0
476 29M 0
513 29M 0
551 29M 0
552 29M 0
553 29M 0
560 29M 0
606 29M 0
618 29M 0
625 29M 0
627 29M 0
636 29M 0
638 29M 0
652 29M 0
787 29M 0
842 29M 0
864 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
967 29M 0
1018 29M 0
1094 29M 0
1122 29M 0
1123 29M 0
1125 29M 0
1126 29M 0
1128 29M 0