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