UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ej4zTysmeSfY8aK535IvS/MpQa2NJnbzA8VS20uwohI=' 
WHERE 
  key_id = 'c32797e93c27c6986d8a197aac7be1a003caa88f555095d90fa7b426f4f3f3e7' 
  AND (
    token = 'ej4zTysmeSfY8aK535IvS/MpQa2NJnbzA8VS20uwohI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020