UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fvWZUefvAw66nfVYZq8A9H5gVR7ENJXDpXVbKR0kB+g='
WHERE
key_id = 'efe04b5dd8ee8062f115e09bb9ddd19179f057d64986918b8919899f0caeae5c'
AND (
token = 'fvWZUefvAw66nfVYZq8A9H5gVR7ENJXDpXVbKR0kB+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)