UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clt5E2upKYDbcqyISMqPYQ9Q6NIM2wIfT7XeS9hx8mI=' 
WHERE 
  key_id = '0d4995828c06e254cfe8443bbf9d714f586aaa47339c8074ea7b476d7648e937' 
  AND (
    token = 'clt5E2upKYDbcqyISMqPYQ9Q6NIM2wIfT7XeS9hx8mI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029