UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OC7w3qcF9JdoOn93GR2XDbVKJN3gQlnss4lvBx0hGAs='
WHERE
key_id = '78f4440ea42479907f63c7638cb8fb6a1f4debc657f896a4f5bf1549c31af0ea'
AND (
token = 'OC7w3qcF9JdoOn93GR2XDbVKJN3gQlnss4lvBx0hGAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)