if mode equals to string 'add' and current_expires is lesser than now, or mode equals to string 'set', and result is true,
if result and ( mode == 'set' or ( mode == 'add' and current_expires < now ) ) :