UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZX/8C8t9RTZc13u1xc+1tslD/04IsnqC0UfXEJzFZF4='
WHERE
key_id = 'fa0bb77846e60f6b8ab976a6bf6e5ecc58a68e35dda02e902705f08e6c4550c9'
AND (
token = 'ZX/8C8t9RTZc13u1xc+1tslD/04IsnqC0UfXEJzFZF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)