SELECT 
  categories.category_id, 
  categories.parent_id, 
  categories.id_path, 
  category_descriptions.category, 
  categories.position, 
  categories.status, 
  categories.company_id 
FROM 
  categories 
  LEFT JOIN category_descriptions ON categories.category_id = category_descriptions.category_id 
  AND category_descriptions.lang_code = 'en' 
WHERE 
  1 = 1 
  AND (
    categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, categories.usergroup_ids) 
    OR FIND_IN_SET(1, categories.usergroup_ids)
  ) 
  AND categories.status IN ('A') 
  AND categories.level <= 3 
  AND categories.deleted_at IS NULL 
  AND categories.company_id = 1522 
ORDER BY 
  categories.is_trash asc, 
  categories.position asc, 
  category_descriptions.category asc

Query time 0.03949

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "1152.86"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "categories",
            "access_type": "ref",
            "possible_keys": [
              "c_status",
              "index_categories_on_deleted_at"
            ],
            "key": "index_categories_on_deleted_at",
            "used_key_parts": [
              "deleted_at"
            ],
            "key_length": "6",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 10182,
            "rows_produced_per_join": 33,
            "filtered": "0.33",
            "index_condition": "(`goimagine`.`categories`.`deleted_at` is null)",
            "cost_info": {
              "read_cost": "120.75",
              "eval_cost": "3.39",
              "prefix_cost": "1138.95",
              "data_read_per_join": "88K"
            },
            "used_columns": [
              "category_id",
              "parent_id",
              "id_path",
              "level",
              "company_id",
              "usergroup_ids",
              "status",
              "position",
              "is_trash",
              "deleted_at"
            ],
            "attached_condition": "((`goimagine`.`categories`.`company_id` = 1522) and ((`goimagine`.`categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`goimagine`.`categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`goimagine`.`categories`.`usergroup_ids`))) and (`goimagine`.`categories`.`status` = 'A') and (`goimagine`.`categories`.`level` <= 3))"
          }
        },
        {
          "table": {
            "table_name": "category_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "goimagine.categories.category_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 33,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "10.52",
              "eval_cost": "3.39",
              "prefix_cost": "1152.86",
              "data_read_per_join": "154K"
            },
            "used_columns": [
              "category_id",
              "lang_code",
              "category"
            ]
          }
        }
      ]
    }
  }
}

Result

category_id parent_id id_path category position status company_id
11431 2021 2021/11431 Animal 0 A 1522
11441 2021 2021/11441 Awareness 0 A 1522
11654 2021 2021/11654 Birthday 0 A 1522
2027 2022 2022/2027 Birthday 0 A 1522
2023 2022 2022/2023 Christmas 0 A 1522
2038 2021 2021/2038 Christmas 0 A 1522
2029 2022 2022/2029 Dad 0 A 1522
11655 2021 2021/11655 Fall 0 A 1522
11437 2021 2021/11437 Food & Drink 0 A 1522
2035 2021 2021/2035 Gnomes 0 A 1522
2024 2022 2022/2024 Halloween 0 A 1522
2039 2021 2021/2039 Halloween 0 A 1522
11435 2021 2021/11435 Hobbies 0 A 1522
2033 2021 2021/2033 Medical 0 A 1522
2030 2022 2022/2030 Mom 0 A 1522
11436 2021 2021/11436 Music 0 A 1522
11440 2021 2021/11440 Patriotic 0 A 1522
2032 2022 2022/2032 School 0 A 1522
11430 2022 2022/11430 Science 0 A 1522
2022 0 2022 Shirts 0 A 1522
2037 2022 2022/2037 Sports 0 A 1522
2036 2021 2021/2036 Sports 0 A 1522
2031 2022 2022/2031 St. Patrick's Day 0 A 1522
11656 2021 2021/11656 St. Patrick's Day 0 A 1522
2021 0 2021 SVG 0 A 1522
2034 2021 2021/2034 Teacher 0 A 1522
2028 2022 2022/2028 Teacher 0 A 1522
3514 2021 2021/3514 Thanksgiving 0 A 1522
2025 2022 2022/2025 Thanksgiving 0 A 1522
11439 2021 2021/11439 Truck 0 A 1522
11442 2021 2021/11442 Unicorns 0 A 1522
11438 2021 2021/11438 Valentine's Day 0 A 1522
2026 2022 2022/2026 Valentine's Day 0 A 1522
11433 2021 2021/11433 Vegan/Vegetarian 0 A 1522
11657 2021 2021/11657 Wedding 0 A 1522
11432 2021 2021/11432 Words 0 A 1522