UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2qQJwqdClmqgavhwArlLLvklPcObXup0bFshAWsAytg=' 
WHERE 
  key_id = 'd8429fae356f19aa05cf4bda06c5c4bb374b5510bd671ad7969030db977bd86e' 
  AND (
    token = '2qQJwqdClmqgavhwArlLLvklPcObXup0bFshAWsAytg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041