UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yt4ygtTYyns9ka18UX9VXC0FhB8X+2ZUsQPIwShSC2M=' 
WHERE 
  key_id = 'd6f4f14d466c53c9bef84050616f7ea90ad0cbb25b4be13e44b8865f051c366c' 
  AND (
    token = 'Yt4ygtTYyns9ka18UX9VXC0FhB8X+2ZUsQPIwShSC2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039