SELECT 
  c.*, 
  IF (c.location_id != 22, 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 = 2 
WHERE 
  1 
  AND c.position IN ('TOP_PANEL', 'HEADER', 'FOOTER') 
  AND c.company_id = 0

Query time 0.00049

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE c ALL location_id,location_id_company_id,location_id_position_company_id 144 Using where
1 SIMPLE l eq_ref PRIMARY PRIMARY 3 hobilifedt.c.location_id 1 Using where

Result

container_id location_id position width user_class linked_to_default status company_id default
77 20 TOP_PANEL 16 top-grid Y A 0 0
78 20 HEADER 16 header-grid Y A 0 0
80 20 FOOTER 16 ty-footer-grid Y A 0 0