The house would need to appraise at the contract price of $312K in order for the deal to move foward. Without that, your mortgage would not be able to go through. Thus, you should be okay unless there is a signed addendum that you agree to purchase the property if it appraises for less which does not really make sense to agree to. If you have further questions, feel free to email us.
Otherwise, good luck with your deal !
As always, the best person to ask these questions to and get advice from is your buyers agent !