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 (
    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.00185

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": 48,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (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
407 29M 0
417 29M 0
433 29M 0
434 29M 0
435 29M 0
456 29M 0
471 29M 0
491 29M 0
493 29M 0
495 29M 0
514 29M 0
515 29M 0
517 29M 0
523 29M 0
542 29M 0
559 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
610 29M 0
635 29M 0
650 29M 0
651 29M 0
654 29M 0
755 29M 0
756 29M 0
813 29M 0
823 29M 0
844 29M 0
858 29M 0
863 29M 0
866 29M 0
867 29M 0
868 29M 0
938 29M 0
946 29M 0
1037 29M 0
1042 29M 0
1044 29M 0
1086 29M 0
1127 29M 0