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.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 = 2712 
WHERE 
  cscart_products_categories.product_id IN (
    70149, 69350, 69997, 65553, 65832, 65096, 
    67762, 68110, 67730, 68008, 68009, 
    68052, 68065, 65122, 68039, 68071, 
    68085, 68086, 68101, 64976, 67769, 
    68057, 68058, 69972, 19741, 19744, 
    19748, 27363, 27368, 27370, 68038, 
    68089, 68099, 69999, 19742, 19743, 
    19745, 19746, 19747, 19749, 19750, 
    19751, 19752, 19753, 19754, 19755, 
    27337, 27339
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00178

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "125.23"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt",
              "idx_product_category_lookup",
              "idx_products_categories_composite"
            ],
            "key": "idx_products_categories_composite",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 83,
            "rows_produced_per_join": 83,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "8.80",
              "eval_cost": "8.30",
              "prefix_cost": "17.10",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`cscart_db`.`cscart_products_categories`.`product_id` in (70149,69350,69997,65553,65832,65096,67762,68110,67730,68008,68009,68052,68065,65122,68039,68071,68085,68086,68101,64976,67769,68057,68058,69972,19741,19744,19748,27363,27368,27370,68038,68089,68099,69999,19742,19743,19745,19746,19747,19749,19750,19751,19752,19753,19754,19755,27337,27339))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt",
              "idx_product_category_lookup",
              "idx_products_categories_composite"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "cscart_db.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 83,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "70.77",
              "eval_cost": "8.30",
              "prefix_cost": "96.18",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "p_category_id",
              "idx_categories_storefront_status",
              "idx_categories_usergroup_status",
              "idx_categories_status_id_path"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "cscart_db.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 68,
            "filtered": "81.96",
            "cost_info": {
              "read_cost": "20.75",
              "eval_cost": "6.80",
              "prefix_cost": "125.23",
              "data_read_per_join": "190K"
            },
            "used_columns": [
              "category_id",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`cscart_db`.`cscart_categories`.`storefront_id` in (0,1)) and (`cscart_db`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
19741 438,2720M,3089
19742 438,2720M,3089
19743 438,2720M,3089
19744 438,2720M,3089
19745 438,2720M,3089
19746 438,2720M,3089
19747 438,2720M,3089
19748 438,2720M,3089
19749 438,2720M,3089
19750 438,2720M,3089
19751 438,2720M,3089
19752 438,2720M,3089
19753 438,2720M,3089
19754 438,2720M,3089
19755 438,2720M,3089
27337 3089M
27339 3089M
27363 2850M,3089
27368 2850M,3089
27370 2850M,3089
64976 2712M 0
65096 2714M
65122 2714M
65553 2301,2924M
65832 2716M
67730 2715M
67762 2713M
67769 2924M
68008 2924M
68009 2713M
68038 2715M
68039 2924M
68052 2714M
68057 2924M
68058 2924M
68065 2924M
68071 2924M
68085 2714M
68086 2924M
68089 2716M
68099 2924M
68101 2714M
68110 2713M
69350 2714M
69972 3089M,3180
69997 2716M
69999 2716M
70149 2924M