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 (
    23544, 22290, 22291, 24832, 24751, 19937, 
    20381, 21914, 23514, 23512, 20084, 
    24836, 23432, 20695, 20466, 20077, 
    24746, 25062, 20083
  ) 
ORDER BY 
  purpose_position ASC, 
  pf.position ASC, 
  pf.feature_id ASC

Query time 0.00172

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": 19,
              "filtered": 100,
              "index_condition": "pf.feature_id in (23544,22290,22291,24832,24751,19937,20381,21914,23514,23512,20084,24836,23432,20695,20466,20077,24746,25062,20083)"
            }
          }
        }
      },
      {
        "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
19937 dropdown_labels 0 group_variation_catalog_item N Option Option 1
20077 dropdown_labels 0 group_variation_catalog_item N Choose the first tea flavor 10041_92 - loại trà là nhiên 1
20083 dropdown_labels 0 group_variation_catalog_item N Pick blend tea flavor Pick blend tea flavor 1
20084 dropdown_labels 0 group_variation_catalog_item N Pick tea flavor Pick tea flavor 1
20381 dropdown_labels 0 group_variation_catalog_item N Option Option 1
20466 dropdown_labels 0 group_variation_catalog_item N Option Option 1
20695 dropdown_labels 0 group_variation_catalog_item N Select the type of mixed pepper in the pepper mill Select the type of mixed pepper in the pepper mill 1
21914 dropdown_labels 0 group_variation_catalog_item N Option Option 1
22290 dropdown 0 group_variation_catalog_item N Choose Your Bride Choose Your Bride 1
22291 dropdown 0 group_variation_catalog_item N Choose Your Groom Choose Your Groom 1
23432 dropdown_labels 0 group_variation_catalog_item N Choose box patterns 10262_34 - thiết kế 1
23514 dropdown_labels 0 group_variation_catalog_item N Choose the pattern 10132_11 - hoạ tiết 1
23544 dropdown_labels 0 group_variation_catalog_item N Choose color 10569_11 - màu 1
24746 dropdown_labels 0 group_variation_catalog_item N Choose bracelet size 10018_112 - size vòng 1
24751 dropdown_labels 0 group_variation_catalog_item N Choose color 10776_05 - màu 1
24832 dropdown_labels 0 group_variation_catalog_item N Option 10206_12 - option 1
24836 dropdown_labels 0 group_variation_catalog_item N Choose design 10262_35 - option 1
25062 dropdown_labels 0 group_variation_catalog_item Y Chọn size Chọn size 1
23512 dropdown_labels 4 group_variation_catalog_item N Choose leather color 10132_09 - màu da 1