SELECT 
  c.*, 
  IF (c.location_id != 84, 0, 1) as `default` 
FROM 
  q_bm_containers as c 
  INNER JOIN q_bm_locations as l ON c.location_id = l.location_id 
  AND l.is_default = 1 
  AND l.layout_id = 4 
WHERE 
  1 
  AND c.position IN ('TOP_PANEL', 'HEADER', 'FOOTER') 
  AND c.company_id = 0

Query time 0.00049

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "24.86"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "l",
          "access_type": "ALL",
          "possible_keys": [
            "PRIMARY"
          ],
          "rows_examined_per_scan": 87,
          "rows_produced_per_join": 0,
          "filtered": "1.15",
          "cost_info": {
            "read_cost": "19.86",
            "eval_cost": "0.20",
            "prefix_cost": "20.06",
            "data_read_per_join": "231"
          },
          "used_columns": [
            "location_id",
            "is_default",
            "layout_id"
          ],
          "attached_condition": "((`portal`.`l`.`layout_id` = 4) and (`portal`.`l`.`is_default` = 1))"
        }
      },
      {
        "table": {
          "table_name": "c",
          "access_type": "ref",
          "possible_keys": [
            "location_id",
            "location_id_company_id",
            "location_id_position_company_id"
          ],
          "key": "location_id",
          "used_key_parts": [
            "location_id"
          ],
          "key_length": "3",
          "ref": [
            "portal.l.location_id"
          ],
          "rows_examined_per_scan": 4,
          "rows_produced_per_join": 0,
          "filtered": "5.00",
          "cost_info": {
            "read_cost": "4.00",
            "eval_cost": "0.04",
            "prefix_cost": "24.86",
            "data_read_per_join": "81"
          },
          "used_columns": [
            "container_id",
            "location_id",
            "position",
            "width",
            "user_class",
            "linked_to_default",
            "status",
            "company_id"
          ],
          "attached_condition": "((`portal`.`c`.`company_id` = 0) and (`portal`.`c`.`position` in ('TOP_PANEL','HEADER','FOOTER')))"
        }
      }
    ]
  }
}

Result

container_id location_id position width user_class linked_to_default status company_id default
253 64 TOP_PANEL 16 top-grid Y A 0 0
254 64 HEADER 16 header-grid Y A 0 0
256 64 FOOTER 16 ty-footer-grid b-top Y A 0 0