UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8J7i7QpztRb41fxxYuDK9g4MkVW6Pw1S4uuLm+SFEig='
WHERE
key_id = 'cce4c93763860999d6df29f94a05eccbbadaa599c078e64ce29a8eda926edb3a'
AND (
token = '8J7i7QpztRb41fxxYuDK9g4MkVW6Pw1S4uuLm+SFEig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)