SELECT 
  pf.feature_id, 
  pf.company_id, 
  pf.feature_type, 
  pf.parent_id, 
  pf.display_on_product, 
  pf.display_on_catalog, 
  pf.display_on_header, 
  cscart_product_features_descriptions.description, 
  cscart_product_features_descriptions.internal_name, 
  cscart_product_features_descriptions.lang_code, 
  cscart_product_features_descriptions.prefix, 
  cscart_product_features_descriptions.suffix, 
  pf.categories_path, 
  cscart_product_features_descriptions.full_description, 
  pf.status, 
  pf.comparison, 
  pf.position, 
  pf.purpose, 
  pf.feature_style, 
  pf.filter_style, 
  pf.feature_code, 
  pf.timestamp, 
  pf.updated_timestamp 
FROM 
  cscart_product_features AS pf 
  LEFT JOIN cscart_product_features_descriptions ON cscart_product_features_descriptions.feature_id = pf.feature_id 
  AND cscart_product_features_descriptions.lang_code = 'en' 
WHERE 
  pf.feature_type = 'G' 
  AND (
    pf.feature_id IN ('') 
    OR pf.feature_id NOT IN (
      SELECT 
        parent_id 
      FROM 
        cscart_product_features
    )
  ) 
  AND pf.display_on_product = 'Y' 
  AND (
    pf.categories_path = '' 
    OR ISNULL(pf.categories_path) 
    OR FIND_IN_SET(5188, pf.categories_path) 
    OR FIND_IN_SET(4936, pf.categories_path)
  ) 
ORDER BY 
  pf.position, 
  cscart_product_features_descriptions.description

Query time 0.03373

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "977.87"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "pf",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY"
            ],
            "rows_examined_per_scan": 9063,
            "rows_produced_per_join": 90,
            "filtered": "1.00",
            "cost_info": {
              "read_cost": "937.09",
              "eval_cost": "9.06",
              "prefix_cost": "946.15",
              "data_read_per_join": "38K"
            },
            "used_columns": [
              "feature_id",
              "feature_code",
              "company_id",
              "feature_type",
              "categories_path",
              "parent_id",
              "display_on_product",
              "display_on_catalog",
              "display_on_header",
              "status",
              "position",
              "comparison",
              "purpose",
              "feature_style",
              "filter_style",
              "timestamp",
              "updated_timestamp"
            ],
            "attached_condition": "((`s2cart`.`pf`.`feature_type` = 'G') and ((`s2cart`.`pf`.`feature_id` = 0) or <in_optimizer>(`s2cart`.`pf`.`feature_id`,`s2cart`.`pf`.`feature_id` in ( <materialize> (/* select#2 */ select `s2cart`.`cscart_product_features`.`parent_id` from `s2cart`.`cscart_product_features` where true ), <primary_index_lookup>(`s2cart`.`pf`.`feature_id` in <temporary table> on <auto_distinct_key> where ((`s2cart`.`pf`.`feature_id` = `<materialized_subquery>`.`parent_id`)))) is false)) and (`s2cart`.`pf`.`display_on_product` = 'Y') and ((`s2cart`.`pf`.`categories_path` = '') or (`s2cart`.`pf`.`categories_path` is null) or (0 <> find_in_set(5188,`s2cart`.`pf`.`categories_path`)) or (0 <> find_in_set(4936,`s2cart`.`pf`.`categories_path`))))",
            "attached_subqueries": [
              {
                "table": {
                  "table_name": "<materialized_subquery>",
                  "access_type": "eq_ref",
                  "key": "<auto_key>",
                  "key_length": "3",
                  "rows_examined_per_scan": 1,
                  "materialized_from_subquery": {
                    "using_temporary_table": true,
                    "dependent": true,
                    "cacheable": false,
                    "query_block": {
                      "select_id": 2,
                      "cost_info": {
                        "query_cost": "946.15"
                      },
                      "table": {
                        "table_name": "cscart_product_features",
                        "access_type": "ALL",
                        "rows_examined_per_scan": 9063,
                        "rows_produced_per_join": 9063,
                        "filtered": "100.00",
                        "cost_info": {
                          "read_cost": "39.85",
                          "eval_cost": "906.30",
                          "prefix_cost": "946.15",
                          "data_read_per_join": "3M"
                        },
                        "used_columns": [
                          "parent_id"
                        ]
                      }
                    }
                  }
                }
              }
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_product_features_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "feature_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "s2cart.pf.feature_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 90,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "22.66",
              "eval_cost": "9.06",
              "prefix_cost": "977.87",
              "data_read_per_join": "206K"
            },
            "used_columns": [
              "feature_id",
              "description",
              "full_description",
              "prefix",
              "suffix",
              "lang_code",
              "internal_name"
            ]
          }
        }
      ]
    }
  }
}