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