SELECT 
  pf.feature_id, 
  pf.feature_style, 
  pf.position, 
  pf.purpose, 
  pf.display_on_catalog, 
  pfd.description, 
  pfd.internal_name, 
  pfd.prefix, 
  pfd.suffix, 
  (
    CASE WHEN pf.purpose = 'group_catalog_item' THEN 0 ELSE 1 END
  ) AS purpose_position 
FROM 
  cscart_product_features AS pf 
  INNER JOIN cscart_product_features_descriptions AS pfd ON pf.feature_id = pfd.feature_id 
  AND pfd.lang_code = 'en' 
WHERE 
  pf.feature_id IN (
    24017, 24012, 24006, 24013, 24011, 24015, 
    24014, 24010, 24007, 24009
  ) 
ORDER BY 
  purpose_position ASC, 
  pf.position ASC, 
  pf.feature_id ASC

Query time 0.00161

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "case when pf.purpose = 'group_catalog_item' then 0 else 1 end, pf.position, pf.feature_id",
            "table": {
              "table_name": "pf",
              "access_type": "range",
              "possible_keys": ["PRIMARY"],
              "key": "PRIMARY",
              "key_length": "3",
              "used_key_parts": ["feature_id"],
              "rows": 10,
              "filtered": 100,
              "index_condition": "pf.feature_id in (24017,24012,24006,24013,24011,24015,24014,24010,24007,24009)"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "pfd",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["feature_id", "lang_code"],
          "ref": ["dev_db.pf.feature_id", "const"],
          "rows": 1,
          "filtered": 100,
          "index_condition": "pfd.lang_code = 'en'"
        }
      }
    ]
  }
}

Result

feature_id feature_style position purpose display_on_catalog description internal_name prefix suffix purpose_position
24006 dropdown_labels 0 group_variation_catalog_item N Choose volume 10697_01 - Dung Tích 1
24007 dropdown_labels 0 group_variation_catalog_item N Choose volume 10697_02 - Dung tích 1
24009 dropdown_labels 0 group_variation_catalog_item N Choose volume 10697_03 - Dung tích 1
24010 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_04 - Khối lượng 1
24011 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_05 - Khối lượng 1
24012 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_06 - Khối lượng 1
24013 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_07 - Khối lượng 1
24014 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_08 - Khối lượng 1
24015 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_09 - Khối lượng 1
24017 dropdown_labels 0 group_variation_catalog_item N Choose weight 10697_10 - Khối lượng 1