code: def invalidate_previous_tokens(sender, instance, **kwargs):
      
      active_tokens = None
      if isinstance(instance, CallbackToken):
          active_tokens = CallbackToken.objects.active().filter(user=instance.user).exclude(id=instance.id)
  
      # Invalidate tokens
      if active_tokens:
          for token in active_tokens:
              token.is_active = False
              token.save()
docs: Invalidates all previously issued tokens as a post_save signal.