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 (
    2152, 2121, 2122, 2123, 2124, 2125, 2120, 
    2119, 2118, 2115, 2116, 2117, 2114, 
    2113, 2110, 2111, 2112, 2109, 2106, 
    2107, 2108, 2105, 2091, 2068
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00127

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "26.01"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 25,
            "rows_produced_per_join": 25,
            "filtered": "100.00",
            "index_condition": "(`wearethehelpful_scalesta_net`.`cscart_products_categories`.`product_id` in (2152,2121,2122,2123,2124,2125,2120,2119,2118,2115,2116,2117,2114,2113,2110,2111,2112,2109,2106,2107,2108,2105,2091,2068))",
            "cost_info": {
              "read_cost": "14.76",
              "eval_cost": "2.50",
              "prefix_cost": "17.26",
              "data_read_per_join": "400"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "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": [
              "wearethehelpful_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "6.25",
              "eval_cost": "0.13",
              "prefix_cost": "26.01",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`wearethehelpful_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`wearethehelpful_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`wearethehelpful_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
2068 310M
2091 308,309,310M
2105 268M
2106 268M
2107 268M
2108 268M
2109 268M
2110 268M
2111 268M
2112 268M
2113 268M
2114 268M
2115 268M
2116 268M
2117 268M
2118 268M
2119 268M
2120 268M
2121 268M
2122 268M
2123 268M
2124 268M
2125 268M
2152 268M