UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FKYF5wqLyyQ/eqmtTlC5+Pwvn/1rDAn+VASk4Jz7gI0='
WHERE
key_id = '78c0d2f5017b53475d6cdae4107f740fa617f1428b27c9f7a24e42c965c60114'
AND (
token = 'FKYF5wqLyyQ/eqmtTlC5+Pwvn/1rDAn+VASk4Jz7gI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)