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 (
    427214, 390160, 389481, 389483, 427216, 
    388722, 427215, 388890, 390264, 389298, 
    389462, 388844, 390175, 389444, 388558, 
    388967, 389836, 388455, 390211, 388642, 
    415655, 389567, 389347, 415501, 389591, 
    389854, 390309, 390251, 390226, 389834, 
    388395, 388497, 389163, 388912, 415654, 
    415656, 415382, 388942, 415377, 415495, 
    390245, 389852, 389054, 390237, 415469, 
    390205, 390305, 389833, 415531, 389229, 
    389487, 415663, 389432, 388953, 390193, 
    388447, 388963, 390223, 388957, 389431, 
    388574, 389542, 388453, 390122, 426897, 
    389873, 390161, 390273, 389522, 388958, 
    390135, 389263, 389558, 389452, 388422, 
    390224, 388479, 388513, 390192, 390209, 
    390257, 415496, 389507, 388544, 388454, 
    390198, 389359, 390316, 389532, 390129, 
    390164, 390243, 389428, 389827
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00264

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "264.35"
    },
    "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": 94,
            "rows_produced_per_join": 94,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "19.95",
              "eval_cost": "18.80",
              "prefix_cost": "38.75",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (427214,390160,389481,389483,427216,388722,427215,388890,390264,389298,389462,388844,390175,389444,388558,388967,389836,388455,390211,388642,415655,389567,389347,415501,389591,389854,390309,390251,390226,389834,388395,388497,389163,388912,415654,415656,415382,388942,415377,415495,390245,389852,389054,390237,415469,390205,390305,389833,415531,389229,389487,415663,389432,388953,390193,388447,388963,390223,388957,389431,388574,389542,388453,390122,426897,389873,390161,390273,389522,388958,390135,389263,389558,389452,388422,390224,388479,388513,390192,390209,390257,415496,389507,388544,388454,390198,389359,390316,389532,390129,390164,390243,389428,389827))"
          }
        },
        {
          "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": 94,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "94.00",
              "eval_cost": "18.80",
              "prefix_cost": "151.55",
              "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": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "94.00",
              "eval_cost": "0.94",
              "prefix_cost": "264.35",
              "data_read_per_join": "27K"
            },
            "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
388395 10439M
388422 10438M
388447 10440M
388453 10438M
388454 10438M
388455 10438M
388479 10438M
388497 10438M
388513 10438M
388544 10439M
388558 10438M
388574 10438M
388642 10438M
388722 10438M
388844 10439M
388890 10438M
388912 10439M
388942 10438M
388953 10439M
388957 10439M
388958 10439M
388963 10439M
388967 10439M
389054 10438M
389163 10438M
389229 10439M
389263 10446M
389298 10443M
389347 10446M
389359 10446M
389428 10446M
389431 10446M
389432 10446M
389444 10446M
389452 10446M
389462 10440M
389481 10438M
389483 10438M
389487 10438M
389507 10439M
389522 10438M
389532 10439M
389542 10439M
389558 10438M
389567 10438M
389591 10438M
389827 10439M
389833 10438M
389834 10439M
389836 10439M
389852 10438M
389854 10439M
389873 10439M
390122 10438M
390129 10438M
390135 10438M
390160 10438M
390161 10438M
390164 10438M
390175 10438M
390192 10438M
390193 10438M
390198 10439M
390205 10438M
390209 10438M
390211 10439M
390223 10439M
390224 10439M
390226 10439M
390237 10439M
390243 10439M
390245 10439M
390251 10439M
390257 10440M
390264 10440M
390273 10440M
390305 10446M
390309 10446M
390316 10446M
415377 10438M
415382 10438M
415469 10438M
415495 10439M
415496 10438M
415501 10438M
415531 10443M
415654 10443M
415655 10443M
415656 10443M
415663 10438M
426897 10438M
427214 10439M
427215 10439M
427216 10438M