Updating table basing on composite primary keys from derived table
Use correlated subquery

UPDATE `TableA`  
SET `TableA`.`enable` = 1
WHERE EXISTS ( SELECT 1
               FROM `TableB` 
               WHERE `TableA`.`code` = `TableB`.`code` 
                 AND `TableB`.`loc` = 'foo' )