UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g4IuKTv+a7gkcYz7yQ6gQmHCw7NG6U3Wv/2SUzzl+fg=' 
WHERE 
  key_id = '08cfa9a3b2dad6c8e66690464cfe7cd2b53c97a791d3f3ad4c6cb9e1bfd7ad3a' 
  AND (
    token = 'g4IuKTv+a7gkcYz7yQ6gQmHCw7NG6U3Wv/2SUzzl+fg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043