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 = 10437 
WHERE 
  cscart_products_categories.product_id IN (
    389137, 415660, 389200, 435303, 388788, 
    389835, 388510, 389810, 427217, 425347, 
    390290, 390241, 389859, 389060, 415383, 
    389208, 388646, 389352, 388796, 388698, 
    389460, 389091, 388735, 415385, 426890, 
    389205, 390141, 435215, 388655, 389361, 
    434573, 388392, 389207, 389812, 389043, 
    415499, 389198, 388465, 390112, 388429, 
    388746, 389482, 390168, 391773, 388927, 
    415727, 388576, 390200, 390126, 388653, 
    389832, 390111, 388379, 389174, 389536, 
    415473, 389494, 389500, 390240, 389571, 
    435214, 388421, 388520, 415523, 388384, 
    435297, 388742, 388675, 415513, 435291, 
    389504, 415704, 388803, 388946, 415533, 
    388858, 390293, 435292, 389363, 388710, 
    389527, 388677, 388854, 388435, 388593, 
    388423, 388591, 388717, 388979, 388624, 
    427198, 389476, 415315, 389216, 388458, 
    390239, 415504, 415472, 389524, 389100
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00312

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "286.76"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 102,
            "rows_produced_per_join": 102,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "21.56",
              "eval_cost": "20.40",
              "prefix_cost": "41.96",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (389137,415660,389200,435303,388788,389835,388510,389810,427217,425347,390290,390241,389859,389060,415383,389208,388646,389352,388796,388698,389460,389091,388735,415385,426890,389205,390141,435215,388655,389361,434573,388392,389207,389812,389043,415499,389198,388465,390112,388429,388746,389482,390168,391773,388927,415727,388576,390200,390126,388653,389832,390111,388379,389174,389536,415473,389494,389500,390240,389571,435214,388421,388520,415523,388384,435297,388742,388675,415513,435291,389504,415704,388803,388946,415533,388858,390293,435292,389363,388710,389527,388677,388854,388435,388593,388423,388591,388717,388979,388624,427198,389476,415315,389216,388458,390239,415504,415472,389524,389100))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "webmarco.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 102,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "102.00",
              "eval_cost": "20.40",
              "prefix_cost": "164.36",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "102.00",
              "eval_cost": "1.02",
              "prefix_cost": "286.76",
              "data_read_per_join": "30K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
388379 10438M
388384 10439M
388392 10439M
388421 10442M
388423 10438M
388429 10438M
388435 10442M
388458 10438M
388465 10438M
388510 10438M
388520 10438M
388576 10438M
388591 10439M
388593 10442M
388624 10441M
388646 10438M
388653 10439M
388655 10439M
388675 10440M
388677 10440M
388698 10438M
388710 10438M
388717 10438M
388735 10438M
388742 10442M
388746 10438M
388788 10438M
388796 10438M
388803 10438M
388854 10438M
388858 10438M
388927 10439M
388946 10439M
388979 10439M
389043 10442M
389060 10442M
389091 10438M
389100 10442M
389137 10442M
389174 10439M
389198 10438M
389200 10438M
389205 10442M
389207 10439M
389208 10439M
389216 10439M
389352 10446M
389361 10446M
389363 10446M
389460 10440M
389476 10438M
389482 10438M
389494 10442M
389500 10438M
389504 10442M
389524 10441M
389527 10439M
389536 10439M
389571 10442M
389810 10442M
389812 10442M
389832 10442M
389835 10439M
389859 10439M
390111 10438M
390112 10438M
390126 10438M
390141 10443M
390168 10438M
390200 10438M
390239 10438M
390240 10438M
390241 10438M
390290 10447M
390293 10447M
391773 10438M
415315 10442M
415383 10442M
415385 10438M
415472 10442M
415473 10442M
415499 10442M
415504 10442M
415513 10442M
415523 10439M
415533 10446M
415660 10443M
415704 10439M
415727 10438M
425347 10438M
426890 10442M
427198 10439M
427217 10442M
434573 10442M
435214 10446,5371M
435215 5371,10446M
435291 10438M
435292 10438M
435297 10438M
435303 10438M