UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MHfoFsDkIPwk0JtI/18gFEzhrRMCj6kZXbBopUeIcjQ=' 
WHERE 
  key_id = '04e53b102112692f12240d4eef94a3ed23caf2f8958254df3b1f974fc6431b11' 
  AND (
    token = 'MHfoFsDkIPwk0JtI/18gFEzhrRMCj6kZXbBopUeIcjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038