UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1vGQIaTn04P9q1pZtcvJzOiH9z2mkdI9Dj4h9UflHsQ='
WHERE
key_id = '777d1e02b1440831ef68de1e7a13421eb0021ec927745ace665d85a8ebf34daa'
AND (
token = '1vGQIaTn04P9q1pZtcvJzOiH9z2mkdI9Dj4h9UflHsQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)