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 
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') 
WHERE 
  cscart_products_categories.product_id IN (
    466, 467, 468, 469, 470, 471, 472, 473, 
    474, 475, 476, 477, 478, 479, 480, 481, 
    482, 483, 484, 485, 486, 487, 488, 489, 
    490, 491, 492, 493, 494, 495, 496, 497, 
    498, 499, 500, 501, 502, 503, 504, 505, 
    506, 507, 508, 509, 510, 511, 512, 513, 
    514, 515
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00081

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "39.50"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "1.84"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 84,
            "rows_produced_per_join": 3,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "19.55",
              "eval_cost": "0.67",
              "prefix_cost": "20.22",
              "data_read_per_join": "8K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`atulecarter_atul_demo2`.`cscart_categories`.`storefront_id` in (0,1)) and ((`atulecarter_atul_demo2`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`atulecarter_atul_demo2`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`atulecarter_atul_demo2`.`cscart_categories`.`usergroup_ids`)) and (`atulecarter_atul_demo2`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "atulecarter_atul_demo2.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 4,
            "rows_produced_per_join": 1,
            "filtered": "13.67",
            "index_condition": "(`atulecarter_atul_demo2`.`cscart_products_categories`.`product_id` in (466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515))",
            "cost_info": {
              "read_cost": "14.75",
              "eval_cost": "0.37",
              "prefix_cost": "37.66",
              "data_read_per_join": "29"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
466 235M
467 235M
468 235M
469 235M
470 235M
471 235M
472 235M
473 235M
474 235M
475 235M
476 235M
477 235M
478 235M
479 235M
480 235M
481 235M
482 235M
483 235M
484 235M
485 235M
486 235M
487 235M
488 235M
489 235M
490 235M
491 235M
492 235M
493 235M
494 235M
495 235M
496 235M
497 235M
498 235M
499 235M
500 235M
501 235M
502 235M
503 235M
504 235M
505 235M
506 235M
507 235M
508 235M
509 235M
510 235M
511 235M
512 235M
513 235M
514 235M
515 235M