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