UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9DkrXLg+Vv5DHe2sWoTO11XroiHaJzVnZ+WrCkXdSCs=' 
WHERE 
  key_id = '9cc455ec25380318676d26a2a12fbbe482007cbb9ce2bd8518665179002bda4a' 
  AND (
    token = '9DkrXLg+Vv5DHe2sWoTO11XroiHaJzVnZ+WrCkXdSCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020