UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VHcU1nyxL99shWxi7Q6Kgy0ThjWKEnmmYlJDaXjGhwU=' 
WHERE 
  key_id = '7485ce8e63be32eb4691c26bce1479d75334d097846ae27201cd7b8d4160a319' 
  AND (
    token = 'VHcU1nyxL99shWxi7Q6Kgy0ThjWKEnmmYlJDaXjGhwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030