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