UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dQoWpJ/u3+CxOS1roO5te/rm7EEpTBdWd7qJlivdoUA=' 
WHERE 
  key_id = '7f7c330b34dfc9bf78d05e9a919ee6b9a7ea817a68281613f93acc60e39ff451' 
  AND (
    token = 'dQoWpJ/u3+CxOS1roO5te/rm7EEpTBdWd7qJlivdoUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028