UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w07feHghWj4G/T1GwxVMS2pVyIqDjAqcu+h7xbXXgHM='
WHERE
key_id = '51a05fecac8d72544d4152708a8b56462ab311d405e2c83a1087d5fdc87c0a66'
AND (
token = 'w07feHghWj4G/T1GwxVMS2pVyIqDjAqcu+h7xbXXgHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)