SELECT 
  c.category_id, 
  IF(pc.link_type = 'M', 1, 0) as is_main 
FROM 
  cscart_categories AS c 
  LEFT JOIN cscart_products_categories AS pc ON c.category_id = pc.category_id 
WHERE 
  pc.product_id = 992088 
  AND c.company_id = 1 
ORDER BY 
  is_main DESC

Query time 0.00032

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.70"
    },
    "ordering_operation": {
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "pc",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 2,
            "rows_produced_per_join": 2,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "0.80",
              "eval_cost": "0.20",
              "prefix_cost": "1.00",
              "data_read_per_join": "32"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`maniamall_cscart`.`pc`.`category_id` is not null)"
          }
        },
        {
          "table": {
            "table_name": "c",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "maniamall_cscart.pc.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 0,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "1.50",
              "eval_cost": "0.02",
              "prefix_cost": "2.70",
              "data_read_per_join": "531"
            },
            "used_columns": [
              "category_id",
              "company_id"
            ],
            "attached_condition": "(`maniamall_cscart`.`c`.`company_id` = 1)"
          }
        }
      ]
    }
  }
}

Result

category_id is_main
3158 1
32420 0