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

Query time 0.00880

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 1.300836804,
    "nested_loop": [
      {
        "table": {
          "table_name": "c",
          "access_type": "ALL",
          "possible_keys": [
            "location_id",
            "location_id_company_id",
            "location_id_position_company_id"
          ],
          "loops": 1,
          "rows": 684,
          "cost": 0.11797822,
          "filtered": 100,
          "attached_condition": "c.company_id = 0 and c.position in ('TOP_PANEL','HEADER','FOOTER')"
        }
      },
      {
        "table": {
          "table_name": "l",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["location_id"],
          "ref": ["tmall.c.location_id"],
          "loops": 684,
          "rows": 1,
          "cost": 1.182858584,
          "filtered": 100,
          "attached_condition": "l.is_default = 1 and l.layout_id = 5"
        }
      }
    ]
  }
}

Result

container_id location_id position width user_class linked_to_default status company_id default
365 92 TOP_PANEL 16 top-grid N A 0 0
366 92 HEADER 16 header-grid light-header Y A 0 0
368 92 FOOTER 16 ty-footer-grid Y A 0 0