UPDATE orders SET status=%(status)s WHERE orders.status = %(status_1)s AND orders.date_created < %(date_created_1)s