UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwavtYyDbpZ8okBIyo3PLfAo72aIE2ldz9jmF0HMWis=' 
WHERE 
  key_id = 'c2a2f05e262c2045e2f41b68ac868d174ed8935c5954910556670b4aeae41a90' 
  AND (
    token = 'RwavtYyDbpZ8okBIyo3PLfAo72aIE2ldz9jmF0HMWis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041