The best thing would be to have a second table, with a foreign key to the ads table, a column for the promotion rank (if desired), a column for the expiration date, and a column showing whether it's front page, search, or anything else you want to add later. (ie: 1 for search, 2 for front page, or 'search' and 'front_page' respectively)
When you select an ad to promote, you select from the AD_PROMOTION table and join it to the ADS table. Then, rather than using a cronjob to kill it when the expiration date has gone, you just demote or remove it when it gets selected.
while (ad != null) {
ad = getRandomAd()
if (ad.expires < now()) {
demote(ad);
ad = null; // Make sure you get another one
}
}
Of course, you'd need something in place to make sure you wind up with an ad at some point, since you may not have any promoted ones.
ADS
AD_ID INFORMATION
----- -----------
1 'Max Power'
2 'Min Power'
3 'Homer Simpson'
AD_PROMOTION
AD_ID LEVEL EXPIRATION_DATE PLACE
----- ----- --------------- -----
2 2 2010-02-18 'search'
3 3 2010-03-01 'front_page'
3 2 2010-04-01 'search'