UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yq3hNlj2F6OwHquAgkkgsxHet7M+a+FrACTQd6ovFXw='
WHERE
key_id = 'e4c897be46730bc2bf76259ff462f743008a3da1f456db4eb45c9989b979c0eb'
AND (
token = 'Yq3hNlj2F6OwHquAgkkgsxHet7M+a+FrACTQd6ovFXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)