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