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