Expiring download link

Sorry, anyone know how I would make a download link that expires after either amount of downloads or expired time?