UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IOw9OxilOEN3N0f5N6rGPeqyVo6PuQ7Y9m+OBfqqh7w='
WHERE
key_id = 'f69a12bfc869638be209669e4f3a8116e286f67f8c276d1e3ad798745d21a203'
AND (
token = 'IOw9OxilOEN3N0f5N6rGPeqyVo6PuQ7Y9m+OBfqqh7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)