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

Query time 0.00179

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "220.98"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "l",
          "access_type": "ALL",
          "possible_keys": [
            "PRIMARY"
          ],
          "rows_examined_per_scan": 1874,
          "rows_produced_per_join": 18,
          "filtered": "1.00",
          "cost_info": {
            "read_cost": "192.87",
            "eval_cost": "1.87",
            "prefix_cost": "194.75",
            "data_read_per_join": "4K"
          },
          "used_columns": [
            "location_id",
            "is_default",
            "layout_id"
          ],
          "attached_condition": "((`s2cart`.`l`.`layout_id` = 78) and (`s2cart`.`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": [
            "s2cart.l.location_id"
          ],
          "rows_examined_per_scan": 4,
          "rows_produced_per_join": 3,
          "filtered": "5.00",
          "cost_info": {
            "read_cost": "18.74",
            "eval_cost": "0.37",
            "prefix_cost": "220.98",
            "data_read_per_join": "1K"
          },
          "used_columns": [
            "container_id",
            "location_id",
            "position",
            "width",
            "user_class",
            "linked_to_default",
            "status",
            "company_id"
          ],
          "attached_condition": "((`s2cart`.`c`.`company_id` = 0) and (`s2cart`.`c`.`position` in ('TOP_PANEL','HEADER','FOOTER')))"
        }
      }
    ]
  }
}

Result

container_id location_id position width user_class linked_to_default status company_id default
6301 1576 TOP_PANEL 16 top-grid Y A 0 0
6302 1576 HEADER 16 header-grid light-header v2 Y A 0 0
6304 1576 FOOTER 16 ty-footer-grid Y A 0 0