SELECT 
  c.parent_id, 
  sm.search_phrases, 
  c.category_id 
FROM 
  cscart_categories AS c 
  LEFT JOIN cscart_ab__search_motivation AS sm ON sm.category_id = c.category_id 
  AND sm.lang_code = 'en' 
WHERE 
  c.id_path LIKE "%353%" 
  AND (
    sm.search_phrases != "NULL" 
    OR c.level = (
      SELECT 
        level 
      FROM 
        cscart_categories 
      WHERE 
        category_id = 353
    )
  ) 
  AND c.company_id = 1 
  AND c.status = "A"

Query time 0.00050

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "29.22"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "c",
          "access_type": "ALL",
          "rows_examined_per_scan": 115,
          "rows_produced_per_join": 0,
          "filtered": "0.87",
          "cost_info": {
            "read_cost": "27.82",
            "eval_cost": "0.20",
            "prefix_cost": "28.02",
            "data_read_per_join": "2K"
          },
          "used_columns": [
            "category_id",
            "parent_id",
            "id_path",
            "level",
            "company_id",
            "status"
          ],
          "attached_condition": "((`eshopuga_upgr_4122`.`c`.`company_id` = 1) and (`eshopuga_upgr_4122`.`c`.`id_path` like '%353%') and (`eshopuga_upgr_4122`.`c`.`status` = 'A'))"
        }
      },
      {
        "table": {
          "table_name": "sm",
          "access_type": "ref",
          "possible_keys": [
            "PRIMARY"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "category_id"
          ],
          "key_length": "3",
          "ref": [
            "eshopuga_upgr_4122.c.category_id"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 0,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "1.00",
            "eval_cost": "0.20",
            "prefix_cost": "29.22",
            "data_read_per_join": "31"
          },
          "used_columns": [
            "category_id",
            "lang_code",
            "search_phrases"
          ],
          "attached_condition": "(<if>(found_match(sm), ((`eshopuga_upgr_4122`.`sm`.`search_phrases` <> 'NULL') or (`eshopuga_upgr_4122`.`c`.`level` = (/* select#2 */ select '3' from `eshopuga_upgr_4122`.`cscart_categories` where 1))), true) and <if>(is_not_null_compl(sm), (`eshopuga_upgr_4122`.`sm`.`lang_code` = 'en'), true))",
          "attached_subqueries": [
            {
              "dependent": false,
              "cacheable": true,
              "query_block": {
                "select_id": 2,
                "cost_info": {
                  "query_cost": "1.00"
                },
                "table": {
                  "table_name": "cscart_categories",
                  "access_type": "const",
                  "possible_keys": [
                    "PRIMARY",
                    "p_category_id"
                  ],
                  "key": "PRIMARY",
                  "used_key_parts": [
                    "category_id"
                  ],
                  "key_length": "3",
                  "ref": [
                    "const"
                  ],
                  "rows_examined_per_scan": 1,
                  "rows_produced_per_join": 1,
                  "filtered": "100.00",
                  "cost_info": {
                    "read_cost": "0.00",
                    "eval_cost": "0.20",
                    "prefix_cost": "0.00",
                    "data_read_per_join": "2K"
                  },
                  "used_columns": [
                    "category_id",
                    "level"
                  ]
                }
              }
            }
          ]
        }
      }
    ]
  }
}

Result

parent_id search_phrases category_id
335 353