Failure 03004 when running as a service. No problem from command prompt

Running tomcat from the command line using start-camunda.bat there are no problems.

However, we have been running as an installed Windows service which recently failed. When running as a service I now get [java - Camunda ENGINE-16004 Exception while closing command context - Stack Overflow]on startup.
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-03004 Exception while executing Database Operation 'UPDATE …

There are a number of nested "Caused by: " messages in the log, the root seems to be:

Caused by: org.h2.jdbc.JdbcBatchUpdateException: Timeout trying to lock table {0}; SQL statement:
update ACT_RU_JOB
SET REV_ = ?,
EXECUTION_ID_ = ?,
LOCK_EXP_TIME_ = ?,
LOCK_OWNER_ = ?,
RETRIES_ = ?,
EXCEPTION_STACK_ID_ = ?,
EXCEPTION_MSG_ = ?,
FAILED_ACT_ID_ = ?,
DUEDATE_ = ?,
SUSPENSION_STATE_ = ?,
PROCESS_DEF_ID_ = ?,
PROCESS_DEF_KEY_ = ?,
JOB_DEF_ID_ = ?,
DEPLOYMENT_ID_ = ?,
HANDLER_CFG_ = ?,
PRIORITY_ = ?,
SEQUENCE_COUNTER_ = ?,
LAST_FAILURE_LOG_ID_ = ?

The log suggests a db problem, but why does it only happen when running as a service?

Here’s the log: