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 = 305 
WHERE 
  cscart_products_categories.product_id IN (
    435351, 456510, 404001, 413818, 442117, 
    433550, 450230, 439049, 414690, 448070, 
    414544, 431904, 404473, 422990, 448236, 
    413068, 425901, 407405, 406178, 437072, 
    430766, 447574, 460572, 460325, 406193, 
    451309, 446162, 438117, 439044, 406083, 
    415033, 460158, 422354, 409660, 453640, 
    424754, 410340, 417422, 422439, 422004, 
    421990, 446415, 436834, 440447, 410009, 
    439533, 411516, 442635, 442715, 430741, 
    406089, 410471, 409489, 412459, 424229, 
    448141, 452096, 435935, 450361, 410461, 
    454777, 444113, 417555, 428819, 454049, 
    459252, 405167, 401806, 425534, 458860, 
    447690, 422606, 413386, 442183, 419735, 
    432464, 440571, 426931, 418909, 439791, 
    454556, 443028, 452359, 449330, 402443, 
    418233, 438218, 431841, 439184, 457686, 
    448158, 426138, 428377, 411651, 455838, 
    431788
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00180

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.486027964,
    "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": 96,
          "cost": 0.1728812,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (435351,456510,404001,413818,442117,433550,450230,439049,414690,448070,414544,431904,404473,422990,448236,413068,425901,407405,406178,437072,430766,447574,460572,460325,406193,451309,446162,438117,439044,406083,415033,460158,422354,409660,453640,424754,410340,417422,422439,422004,421990,446415,436834,440447,410009,439533,411516,442635,442715,430741,406089,410471,409489,412459,424229,448141,452096,435935,450361,410461,454777,444113,417555,428819,454049,459252,405167,401806,425534,458860,447690,422606,413386,442183,419735,432464,440571,426931,418909,439791,454556,443028,452359,449330,402443,418233,438218,431841,439184,457686,448158,426138,428377,411651,455838,431788)",
          "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": 96,
          "rows": 1,
          "cost": 0.08668544,
          "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": 96,
          "rows": 1,
          "cost": 0.16450944,
          "filtered": 100
        }
      }
    ]
  }
}

Result

product_id category_ids position
401806 305M 0
402443 305M 0
404001 305M 0
404473 305M 0
405167 305M 0
406083 305M 0
406089 305M 0
406178 305M 0
406193 305M 0
407405 305M 0
409489 305M 0
409660 305M 0
410009 305M 0
410340 305M 0
410461 305M 0
410471 305M 0
411516 305M 0
411651 305M 0
412459 305M 0
413068 305M 0
413386 305M 0
413818 305M 0
414544 305M 0
414690 305M 0
415033 305M 0
417422 305M 0
417555 305M 0
418233 305M 0
418909 305M 0
419735 305M 0
421990 305M 0
422004 305M 0
422354 305M 0
422439 305M 0
422606 305M 0
422990 305M 0
424229 305M 0
424754 305M 0
425534 305M 0
425901 305M 0
426138 305M 0
426931 305M 0
428377 305M 0
428819 305M 0
430741 305M 0
430766 305M 0
431788 305M 0
431841 305M 0
431904 305M 0
432464 305M 0
433550 305M 0
435351 305M 0
435935 305M 0
436834 305M 0
437072 305M 0
438117 305M 0
438218 305M 0
439044 305M 0
439049 305M 0
439184 305M 0
439533 305M 0
439791 305M 0
440447 305M 0
440571 305M 0
442117 305M 0
442183 305M 0
442635 305M 0
442715 305M 0
443028 305M 0
444113 305M 0
446162 305M 0
446415 305M 0
447574 305M 0
447690 305M 0
448070 305M 0
448141 305M 0
448158 305M 0
448236 305M 0
449330 305M 0
450230 305M 0
450361 305M 0
451309 305M 0
452096 305M 0
452359 305M 0
453640 305M 0
454049 305M 0
454556 305M 0
454777 305M 0
455838 305M 0
456510 305M 0
457686 305M 0
458860 305M 0
459252 305M 0
460158 305M 0
460325 305M 0
460572 305M 0