UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'urG2nFuglVmepfHiXHBYHn6kA/32EI+no2ELFpDZLfU=' 
WHERE 
  key_id = '7171aac3573135f1938dbd2b4544beecf9510afe11bed11e296e0426f1412b95' 
  AND (
    token = 'urG2nFuglVmepfHiXHBYHn6kA/32EI+no2ELFpDZLfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039