UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gft3oglj+vJteD9vMNRjR6tVB+azLwndLM0D5J9c6qY=' 
WHERE 
  key_id = '716c117148a8dd966fd8fca05411286115be75c42ba0fe4e6ea2d63d32329a94' 
  AND (
    token = 'Gft3oglj+vJteD9vMNRjR6tVB+azLwndLM0D5J9c6qY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041