UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9yDhmBc45+LZZwe5T4qGo/xV8iQkkFjnozMJOynyh9U='
WHERE
key_id = '18fdcf36e833b614513ec91005c89d8c29fbea346e34a9d74291e5c2d2f17a08'
AND (
token = '9yDhmBc45+LZZwe5T4qGo/xV8iQkkFjnozMJOynyh9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)