def METHOD_NAME():
    now = timezone.now()
    channel_qs = Channel.objects.filter(
        delete_expired_orders_after__gt=timedelta(),
        id=OuterRef("channel"),
    )
    qs = Order.objects.annotate(
        delete_expired_orders_after=Subquery(
            channel_qs.values("delete_expired_orders_after")[:1]
        )
    ).filter(
        ~Exists(TransactionItem.objects.filter(order=OuterRef("pk"))),
        ~Exists(Payment.objects.filter(order=OuterRef("pk"))),
        expired_at__isnull=False,
        status=OrderStatus.EXPIRED,
        expired_at__lte=now - F("delete_expired_orders_after"),  # type:ignore
    )
    ids_batch = qs.values_list("pk", flat=True)[:DELETE_EXPIRED_ORDER_BATCH_SIZE]
    if not ids_batch:
        return
    Order.objects.filter(id__in=ids_batch).delete()
    METHOD_NAME.delay()