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 = 'ru' 
WHERE 
  c.id_path LIKE "%303%" 
  AND (
    sm.search_phrases != "NULL" 
    OR c.level = (
      SELECT 
        level 
      FROM 
        cscart_categories 
      WHERE 
        category_id = 303
    )
  ) 
  AND c.company_id = 0 
  AND c.status = "A"

Query time 0.00108

JSON explain

{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "c",
      "access_type": "ALL",
      "rows": 654,
      "filtered": 100,
      "attached_condition": "c.company_id = 0 and c.id_path like '%303%' and c.`status` = 'A'"
    },
    "table": {
      "table_name": "sm",
      "access_type": "ref",
      "possible_keys": ["PRIMARY"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["category_id"],
      "ref": ["admin_test.c.category_id"],
      "rows": 1,
      "filtered": 100,
      "attached_condition": "trigcond(sm.search_phrases <> 'NULL' or c.`level` = (subquery#2)) and trigcond(sm.lang_code = 'ru')"
    },
    "subqueries": [
      {
        "query_block": {
          "select_id": 2,
          "table": {
            "table_name": "cscart_categories",
            "access_type": "const",
            "possible_keys": ["PRIMARY", "p_category_id"],
            "key": "PRIMARY",
            "key_length": "3",
            "used_key_parts": ["category_id"],
            "ref": ["const"],
            "rows": 1,
            "filtered": 100
          }
        }
      }
    ]
  }
}

Result

parent_id search_phrases category_id
343 344
334 343
307 327
303 304
304 315
307 328
303 305
304 318
307 329
304 311
307 330
303 307
304 314
304 310
307 331
307 332
304 316
304 309
307 333
307 334
304 317
307 335
304 319
307 336
307 337
307 338
307 339
0 303
307 340
304 312
307 341
304 313
307 342
304 308