I think you can just use wpsc_get_customer_meta( 'checkout_session_id' ). It will return an empty string if such meta doesn't exist, so you can make the if clause below much simpler.