UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2ymJ1bqDAGI5gObTxIYzTKAz3yFGpyMs6XnnsIpVHIg='
WHERE
key_id = '9a597e2907ac9db3417e1fc371774d5a10193e06c3775407c7b0d8fc38b19101'
AND (
token = '2ymJ1bqDAGI5gObTxIYzTKAz3yFGpyMs6XnnsIpVHIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)