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 = 'vi' 
WHERE 
  pf.feature_id IN (24075) 
ORDER BY 
  purpose_position ASC, 
  pf.position ASC, 
  pf.feature_id ASC

Query time 0.00168

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "pf",
          "access_type": "const",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["feature_id"],
          "ref": ["const"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "pfd",
          "access_type": "const",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["feature_id", "lang_code"],
          "ref": ["const", "const"],
          "rows": 1,
          "filtered": 100
        }
      }
    ]
  }
}

Result

feature_id feature_style position purpose display_on_catalog description internal_name prefix suffix purpose_position
24075 dropdown_labels 0 group_variation_catalog_item N Chọn size 10676_09 - Size 1