WooCommerce Batch Numbers plugin has a setting to easily archive batches when they got expired. This job runs every day at midnight automatically, by searching into the database looking for rows that are already expired. When it founds something he changes the status to
archived preventing you to sell expired products.
To enable this setting go to Products > Batch Numbers > Options: