Another way of removing the input priority is to set the motion to 0 at the start, then add or subtract the SPEED from motion.x. This means that when both keys are pressed, the speed is both added to 0, and then subtracted, bringing it back to 0.
func _physics_process(delta):
motion = Vector2()
if Input.is_action_pressed("right"):
motion.x += SPEED
if Input.is_action_pressed("left"):
motion.x -= SPEED
move_and_slide(motion)