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