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 = 287 
WHERE 
  cscart_products_categories.product_id IN (
    451077, 403015, 438963, 450825, 401687, 
    443424, 427907, 457801, 454192, 427353, 
    414432, 436128, 421748, 421122, 417392, 
    431455, 406944, 412740, 424119, 412948, 
    446814, 438098, 417337, 414479, 403309, 
    408867, 432076, 429951, 443506, 447548, 
    411429, 410643, 457524, 312409, 312424, 
    312425, 414573, 443819, 451444, 413123, 
    402148, 438958, 422426, 446892, 423821, 
    449843, 410922, 450729
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00110

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.243691242,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "pt",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "loops": 1,
          "rows": 48,
          "cost": 0.08683616,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (451077,403015,438963,450825,401687,443424,427907,457801,454192,427353,414432,436128,421748,421122,417392,431455,406944,412740,424119,412948,446814,438098,417337,414479,403309,408867,432076,429951,443506,447548,411429,410643,457524,312409,312424,312425,414573,443819,451444,413123,402148,438958,422426,446892,423821,449843,410922,450729)",
          "using_index": true
        }
      },
      {
        "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": ["u985510652_ecartify.cscart_products_categories.category_id"],
          "loops": 48,
          "rows": 1,
          "cost": 0.04375232,
          "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",
            "u985510652_ecartify.cscart_products_categories.product_id"
          ],
          "loops": 48,
          "rows": 1,
          "cost": 0.08225472,
          "filtered": 100
        }
      }
    ]
  }
}

Result

product_id category_ids position
312409 304M
312424 288M
312425 288M
401687 289M
402148 305M
403015 289M
403309 305M
406944 305M
408867 289M
410643 289M
410922 305M
411429 305M
412740 289M
412948 305M
413123 289M
414432 289M
414479 289M
414573 289M
417337 305M
417392 289M
421122 289M
421748 289M
422426 289M
423821 305M
424119 305M
427353 305M
427907 305M
429951 305M
431455 305M
432076 289M
436128 289M
438098 305M
438958 305M
438963 289M
443424 289M
443506 289M
443819 305M
446814 289M
446892 289M
447548 289M
449843 305M
450729 289M
450825 305M
451077 289M
451444 289M
454192 289M
457524 289M
457801 289M