UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2mkt9yq+TU2fHyQG0gmUOjcLlCA7MunC1KuGsWyscuY='
WHERE
key_id = 'f68facfb83768a9bc9ee917a10a40bb22b4e22d1ecfa8b95dea1a0923bf83dd6'
AND (
token = '2mkt9yq+TU2fHyQG0gmUOjcLlCA7MunC1KuGsWyscuY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)