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 (
    444839, 428245, 418635, 426766, 438143, 
    427476, 438277, 423983, 418826, 451985, 
    420812, 455665, 404060, 455720, 420563, 
    416787, 428711, 460118, 458461, 403343, 
    405043, 402986, 417129, 414508, 403905, 
    410883, 408899, 408775, 440269, 435840, 
    444141, 410125, 453374, 429849, 427100, 
    430100, 427619, 444547, 432847, 403496, 
    431636, 455406, 435103, 415659, 443503, 
    401160, 406539, 408349
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00116

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 (444839,428245,418635,426766,438143,427476,438277,423983,418826,451985,420812,455665,404060,455720,420563,416787,428711,460118,458461,403343,405043,402986,417129,414508,403905,410883,408899,408775,440269,435840,444141,410125,453374,429849,427100,430100,427619,444547,432847,403496,431636,455406,435103,415659,443503,401160,406539,408349)",
          "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
401160 305M 0
402986 305M 0
403343 305M 0
403496 305M 0
403905 305M 0
404060 305M 0
405043 305M 0
406539 305M 0
408349 305M 0
408775 305M 0
408899 305M 0
410125 305M 0
410883 305M 0
414508 305M 0
415659 305M 0
416787 305M 0
417129 305M 0
418635 305M 0
418826 305M 0
420563 305M 0
420812 305M 0
423983 305M 0
426766 305M 0
427100 305M 0
427476 305M 0
427619 305M 0
428245 305M 0
428711 305M 0
429849 305M 0
430100 305M 0
431636 305M 0
432847 305M 0
435103 305M 0
435840 305M 0
438143 305M 0
438277 305M 0
440269 305M 0
443503 305M 0
444141 305M 0
444547 305M 0
444839 305M 0
451985 305M 0
453374 305M 0
455406 305M 0
455665 305M 0
455720 305M 0
458461 305M 0
460118 305M 0