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 = 7174 
WHERE 
  cscart_products_categories.product_id IN (
    96926, 96927, 96928, 96929, 96930, 96934, 
    96935, 96936, 96937, 96938, 96939, 
    96940, 96941, 98906, 98907, 98908, 
    98909, 100303, 100304, 100305, 100306, 
    100307, 100308, 100450, 100451, 100452, 
    100453, 100454, 100455, 100456, 100457, 
    100464, 100465, 100467, 100468, 100470, 
    100471
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00110

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "33.57"
    },
    "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": 37,
            "rows_produced_per_join": 37,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "3.97",
              "eval_cost": "3.70",
              "prefix_cost": "7.67",
              "data_read_per_join": "592"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (96926,96927,96928,96929,96930,96934,96935,96936,96937,96938,96939,96940,96941,98906,98907,98908,98909,100303,100304,100305,100306,100307,100308,100450,100451,100452,100453,100454,100455,100456,100457,100464,100465,100467,100468,100470,100471))"
          }
        },
        {
          "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": 37,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "9.25",
              "eval_cost": "3.70",
              "prefix_cost": "20.62",
              "data_read_per_join": "592"
            },
            "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": 1,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "9.25",
              "eval_cost": "0.19",
              "prefix_cost": "33.57",
              "data_read_per_join": "4K"
            },
            "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
96926 7174M 0
96927 7174M 0
96928 7174M 0
96929 7174M 0
96930 7174M 0
96934 7174M 0
96935 7174M 0
96936 7174M 0
96937 7174M 0
96938 7174M 0
96939 7174M 0
96940 7174M 0
96941 7174M 0
98906 7174M 0
98907 7174M 0
98908 7174M 0
98909 7174M 0
100303 7174M 0
100304 7174M 0
100305 7174M 0
100306 7174M 0
100307 7174M 0
100308 7174M 0
100450 7174M 0
100451 7174M 0
100452 7174M 0
100453 7174M 0
100454 7174M 0
100455 7174M 0
100456 7174M 0
100457 7174M 0
100464 7174M 0
100465 7174M 0
100467 7174M 0
100468 7174M 0
100470 7174M 0
100471 7174M 0