UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OQkD87nQn+cy9D104NVIGDOdjNomxniXI7/tSoA4Ak4=' 
WHERE 
  key_id = 'f79b28257c5070b782eac0a9e88ddcbc572f100d3fb877942e724350f4b50f8a' 
  AND (
    token = 'OQkD87nQn+cy9D104NVIGDOdjNomxniXI7/tSoA4Ak4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037