class TName(Base):
    end_time = Column(Integer)
start_time = Column(Integer)
calc_column = end_time + case([(end_time < start_time, 86400000)], else_=0)
q2 = session.query(TName.calc_column).order_by(TName.calc_column)
Sqlalchemy order by calculated column