SELECT 
  ushop_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      ushop_products_categories.link_type = "M", 
      CONCAT(
        ushop_products_categories.category_id, 
        "M"
      ), 
      ushop_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  ushop_products_categories 
  INNER JOIN ushop_categories ON ushop_categories.category_id = ushop_products_categories.category_id 
  AND ushop_categories.storefront_id IN (0, 1) 
  AND (
    ushop_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, ushop_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, ushop_categories.usergroup_ids
    )
  ) 
  AND ushop_categories.status IN ('A', 'H') 
  LEFT JOIN ushop_products_categories AS product_position_source ON ushop_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 323 
WHERE 
  ushop_products_categories.product_id IN (
    430, 459, 468, 450, 461, 440, 457, 432, 
    466, 407, 431, 467, 409, 411, 402, 465, 
    395, 404
  ) 
GROUP BY 
  ushop_products_categories.product_id

Query time 0.00279

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "30.96"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "ushop_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 23,
            "rows_produced_per_join": 23,
            "filtered": "100.00",
            "index_condition": "(`marketplace`.`ushop_products_categories`.`product_id` in (430,459,468,450,461,440,457,432,466,407,431,467,409,411,402,465,395,404))",
            "cost_info": {
              "read_cost": "12.56",
              "eval_cost": "2.30",
              "prefix_cost": "14.86",
              "data_read_per_join": "368"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "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",
              "marketplace.ushop_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 23,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "5.75",
              "eval_cost": "2.30",
              "prefix_cost": "22.91",
              "data_read_per_join": "368"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "ushop_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "marketplace.ushop_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "5.75",
              "eval_cost": "0.12",
              "prefix_cost": "30.96",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`marketplace`.`ushop_categories`.`storefront_id` in (0,1)) and ((`marketplace`.`ushop_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`marketplace`.`ushop_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`marketplace`.`ushop_categories`.`usergroup_ids`))) and (`marketplace`.`ushop_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
395 362M
402 362M
404 362M
407 362M
409 362M
411 362M
430 362M
431 362M
432 362M
440 362M
450 368M
457 368M
459 368M
461 368M
465 368M
466 368M
467 368M
468 368M