UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h1Km8tQoWWbbiPzlhZFKf721kz7S1O9je3KCjH7Ug7Q='
WHERE
key_id = 'e5443829ec2955dda7b73e08699a223d0168a83c4216851751835f96cd2d4104'
AND (
token = 'h1Km8tQoWWbbiPzlhZFKf721kz7S1O9je3KCjH7Ug7Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)