Automated background task for some condition

Hello everyone,
I have a Student Doctype and a Subscription Payment Doctype
Student Doctype:
Student Name: Data
Student Status: Select (Active, Inactive, Payment Process, Expired Subscription)

Subscription Payment Doctype:
Student: Link to Student Doctype
Payment Date: Date
Expiration Date: Date
Status: Select (Success, Error, Process, Pending)

Here is the explanation for student status:

  1. Active: When the payment status is Success (I have successfully created it)
  2. Inactive: When a new student registers (I have successfully created it)
  3. Payment Process: When the student’s payment status is Process (I have successfully created it)
  4. Expired Subscription: When the student’s Subscription Payment Expiration Date is > Current date

The question is, how do I create an automated task to change the student’s status based on the subscription payment when the expiration date is > current date in the background? I could make the background task daily, but that would be a burden on the server since it would be run every day and for all students, but is there a better approach in frappe? Thanks a lot