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 = 7149 
WHERE 
  cscart_products_categories.product_id IN (
    94702, 94707, 94708, 96295, 96298, 96299, 
    96300, 96301, 96708, 96718, 96719, 
    96720, 96724, 96734, 96735, 96738, 
    96739, 96743, 96746, 96747, 96749, 
    96751, 96758, 96759, 96764, 96775, 
    96789, 96790, 96985, 96986, 96987, 
    96988, 96989, 96990, 96991, 96992, 
    96993, 96994, 96995, 96996, 96997, 
    96999, 97000, 97001, 97002, 97003, 
    97004, 97005
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00174

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "83.99"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 93,
            "rows_produced_per_join": 93,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.59",
              "eval_cost": "9.30",
              "prefix_cost": "18.89",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (94702,94707,94708,96295,96298,96299,96300,96301,96708,96718,96719,96720,96724,96734,96735,96738,96739,96743,96746,96747,96749,96751,96758,96759,96764,96775,96789,96790,96985,96986,96987,96988,96989,96990,96991,96992,96993,96994,96995,96996,96997,96999,97000,97001,97002,97003,97004,97005))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 93,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "23.25",
              "eval_cost": "9.30",
              "prefix_cost": "51.44",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "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": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "23.25",
              "eval_cost": "0.47",
              "prefix_cost": "83.99",
              "data_read_per_join": "12K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
94702 7305,7160M
94707 7303,7161M
94708 7303,7161M
96295 7301,7151M
96298 7301,7151M
96299 7305,7160M
96300 7305,7160M
96301 7305,7160M
96708 7301,7151M
96718 7301,7151M
96719 7301,7151M
96720 7301,7151M
96724 7301,7151M
96734 7301,7151M
96735 7301,7151M
96738 7301,7151M
96739 7303,7161M
96743 7301,7151M
96746 7162M
96747 7162M
96749 7305,7160M
96751 7162M
96758 7301,7151M
96759 7301,7151M
96764 7301,7151M
96775 7301,7151M
96789 7305,7160M
96790 7305,7160M
96985 7303,7161M
96986 7303,7161M
96987 7303,7161M
96988 7303,7161M
96989 7303,7161M
96990 7303,7161M
96991 7303,7161M
96992 7303,7161M
96993 7303,7161M
96994 7303,7161M
96995 7303,7161M
96996 7303,7161M
96997 7303,7161M
96999 7303,7161M
97000 7303,7161M
97001 7303,7161M
97002 7303,7161M
97003 7303,7161M
97004 7303,7161M
97005 7303,7161M