SELECT 
  SQL_CALC_FOUND_ROWS `B`.`brand_id`, 
  `B`.`brand`, 
  COALESCE(F.path, "") AS image, 
  `PC`.`category_id` 
FROM 
  `cscart_brands` AS `B` 
  LEFT JOIN `files__images` AS `FI` ON `B`.`brand_id` = `FI`.`object_id` 
  AND `FI`.`object_type` = "brand" 
  LEFT JOIN `files` AS `F` ON `F`.`id` = `FI`.`file_id` 
  LEFT JOIN `cscart_products` AS `P` ON `B`.`brand_id` = `P`.`brand_id` 
  LEFT JOIN `cscart_products_categories` AS `PC` ON `PC`.`product_id` = `P`.`product_id` 
  AND `PC`.`link_type` = 'M' 
WHERE 
  1 
  AND `PC`.`category_id` IN (
    568, 569, 575, 655, 656, 657, 658, 659, 
    661, 702, 704, 756, 902, 705, 809
  ) 
  AND `P`.`status` = 'A' 
GROUP BY 
  `B`.`brand_id`, 
  `B`.`brand` 
ORDER BY 
  `B`.`brand` ASC 
LIMIT 
  0, 20

Query time 0.00832

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "3528.95"
    },
    "ordering_operation": {
      "using_filesort": true,
      "grouping_operation": {
        "using_temporary_table": true,
        "using_filesort": false,
        "nested_loop": [
          {
            "table": {
              "table_name": "PC",
              "access_type": "range",
              "possible_keys": [
                "PRIMARY",
                "link_type",
                "pt",
                "idx_pc_product_id_type"
              ],
              "key": "link_type",
              "used_key_parts": [
                "link_type",
                "category_id"
              ],
              "key_length": "6",
              "rows_examined_per_scan": 2218,
              "rows_produced_per_join": 2218,
              "filtered": "100.00",
              "using_index": true,
              "cost_info": {
                "read_cost": "222.67",
                "eval_cost": "221.80",
                "prefix_cost": "444.47",
                "data_read_per_join": "34K"
              },
              "used_columns": [
                "product_id",
                "category_id",
                "link_type"
              ],
              "attached_condition": "((`dev2`.`PC`.`category_id` in (568,569,575,655,656,657,658,659,661,702,704,756,902,705,809)) and (`dev2`.`PC`.`link_type` = 'M'))"
            }
          },
          {
            "table": {
              "table_name": "P",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "status",
                "cscart_products_brand_id_index",
                "cscart_products_product_id_index",
                "idx_status"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "product_id"
              ],
              "key_length": "3",
              "ref": [
                "dev2.PC.product_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1601,
              "filtered": "72.23",
              "cost_info": {
                "read_cost": "554.50",
                "eval_cost": "160.20",
                "prefix_cost": "1220.77",
                "data_read_per_join": "11M"
              },
              "used_columns": [
                "product_id",
                "status",
                "brand_id"
              ],
              "attached_condition": "((`dev2`.`P`.`status` = 'A') and (`dev2`.`P`.`brand_id` is not null))"
            }
          },
          {
            "table": {
              "table_name": "B",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY",
                "cscart_brands_pk2"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "brand_id"
              ],
              "key_length": "4",
              "ref": [
                "dev2.P.brand_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1601,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "400.49",
                "eval_cost": "160.20",
                "prefix_cost": "1781.46",
                "data_read_per_join": "5M"
              },
              "used_columns": [
                "brand_id",
                "brand"
              ]
            }
          },
          {
            "table": {
              "table_name": "FI",
              "access_type": "ref",
              "possible_keys": [
                "idx_fi_object_id_type"
              ],
              "key": "idx_fi_object_id_type",
              "used_key_parts": [
                "object_id",
                "object_type"
              ],
              "key_length": "5",
              "ref": [
                "dev2.P.brand_id",
                "const"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1623,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "405.86",
                "eval_cost": "162.35",
                "prefix_cost": "2349.67",
                "data_read_per_join": "38K"
              },
              "used_columns": [
                "object_id",
                "object_type",
                "file_id"
              ]
            }
          },
          {
            "table": {
              "table_name": "F",
              "access_type": "eq_ref",
              "possible_keys": [
                "PRIMARY"
              ],
              "key": "PRIMARY",
              "used_key_parts": [
                "id"
              ],
              "key_length": "4",
              "ref": [
                "dev2.FI.file_id"
              ],
              "rows_examined_per_scan": 1,
              "rows_produced_per_join": 1623,
              "filtered": "100.00",
              "cost_info": {
                "read_cost": "1016.94",
                "eval_cost": "162.35",
                "prefix_cost": "3528.95",
                "data_read_per_join": "5M"
              },
              "used_columns": [
                "id",
                "path"
              ]
            }
          }
        ]
      }
    }
  }
}

Result

brand_id brand image category_id
8 ABACUS 575
60 ALTAI 659
178 BEIBEN https://s3.timeweb.cloud/482029f9-prod/brands__images/178_5d945d94b139_beiben.jpeg 569
234 BORUS https://s3.timeweb.cloud/482029f9-prod/brands__images/234_da67c1403b1a_jme26iyy2weil11sz6qjcuqd1cfoxa54.png 659
3147 DAYUN 658
3157 Donfeng 569
448 DONGFENG https://s3.timeweb.cloud/482029f9-prod/brands__images/448_294fb333b836_DongFeng.png 569
584 FAW https://s3.timeweb.cloud/482029f9-prod/brands__images/584_393dc2db8548_faw.png 569
627 FOTON https://s3.timeweb.cloud/482029f9-prod/brands__images/627_937f8898211a_FOTON.jpeg 569
827 HONGYAN 569
831 HOWO https://s3.timeweb.cloud/482029f9-prod/brands__images/831_f41d6581e4e4_HOWO.png 569
903 ISUZU 569
3083 IVECO https://s3.timeweb.cloud/482029f9-prod/brands__images/3083_3dcec763d758_Iveco.png 569
911 JAC https://s3.timeweb.cloud/482029f9-prod/brands__images/911_c7ef8bb105f7_jac.png 655
3111 Kaiyi 702
3064 KAMAZ 655
985 KANGLIM 659
1183 MAN https://s3.timeweb.cloud/482029f9-prod/brands__images/1183_dae5ec907165_MAN.png 569
1247 MERCEDES 569
1636 SANY https://s3.timeweb.cloud/482029f9-prod/brands__images/1636_068a2a7d9dbf_Sany.png 569