UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uZ7jGas6xYhLywmhvNnNY0wRpOWJ6w+FXiD85oUsATU='
WHERE
key_id = 'a7d719cc2c69214c26af06df65d7f7442fae869810d9b07e9c38b8435900f718'
AND (
token = 'uZ7jGas6xYhLywmhvNnNY0wRpOWJ6w+FXiD85oUsATU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)