UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yneFKoy92ZIvnW4zS1B9GtpOhnPYB3zbi0Xg8tdlofU=' 
WHERE 
  key_id = 'afd5f8524efe9c1adf8e193732c9ea25cd21bfb4f85b4349e72b26952999b750' 
  AND (
    token = 'yneFKoy92ZIvnW4zS1B9GtpOhnPYB3zbi0Xg8tdlofU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028