UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KAuwzpv3mnQ8G4Y06oAehOMOo/i+IUW0oyQeFGWe2Vk='
WHERE
key_id = '4949e01f74ad54bb8964575fe562dcb60d89923f0ad0012c8c1c42376ea748df'
AND (
token = 'KAuwzpv3mnQ8G4Y06oAehOMOo/i+IUW0oyQeFGWe2Vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)