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