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 = 2686 
WHERE 
  cscart_products_categories.product_id IN (
    2091, 3896, 3897, 8002, 8003, 8018, 9890, 
    12041, 12042, 13068, 13102, 14266, 
    15957, 16999, 17000, 17002, 17003, 
    17083, 17084, 18063, 18071, 24167, 
    25616, 25670
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00116

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "40.55"
    },
    "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": 27,
            "rows_produced_per_join": 27,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "3.04",
              "eval_cost": "2.70",
              "prefix_cost": "5.74",
              "data_read_per_join": "432"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`cscart_db`.`cscart_products_categories`.`product_id` in (2091,3896,3897,8002,8003,8018,9890,12041,12042,13068,13102,14266,15957,16999,17000,17002,17003,17083,17084,18063,18071,24167,25616,25670))"
          }
        },
        {
          "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": 27,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "22.66",
              "eval_cost": "2.70",
              "prefix_cost": "31.10",
              "data_read_per_join": "432"
            },
            "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": 22,
            "filtered": "81.96",
            "cost_info": {
              "read_cost": "6.75",
              "eval_cost": "2.21",
              "prefix_cost": "40.55",
              "data_read_per_join": "61K"
            },
            "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
2091 2812M
3896 2819M
3897 1952,2819M
8002 2819M
8003 2819M
8018 2821M
9890 2819M
12041 2819M
12042 2819M
13068 2819M
13102 2822M
14266 2819M
15957 2819M
16999 2819M
17000 2819M
17002 2819M
17003 2819M
17083 2819M
17084 2819M
18063 2332,2819M
18071 2332,2819M
24167 2819M
25616 2819M
25670 2819M