UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iMBBXbCOVp2EVFNN90Qny5NeAhfo4Wxk8JIXJUdZ73Q='
WHERE
key_id = 'c6c0abfb6482812394e0c95f55ca289e0aa4e565e6eb0d440de437f8e796c865'
AND (
token = 'iMBBXbCOVp2EVFNN90Qny5NeAhfo4Wxk8JIXJUdZ73Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)